Thread (20 messages) 20 messages, 7 authors, 2021-07-16

Re: [PATCH v1 1/4] serial: 8250_pci: Refactor the loop in pci_ite887x_init()

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date: 2021-07-14 12:37:59
Also in: lkml

On Wed, Jul 14, 2021 at 08:57:06AM +0200, Jiri Slaby wrote:
On 13. 07. 21, 12:40, Andy Shevchenko wrote:
quoted
The loop can be refactored by using ARRAY_SIZE() instead of NULL terminator.
This reduces code base and makes it easier to read and understand.
quoted
+		iobase = request_region(inta_addr[i], ITE_887x_IOSIZE, "ite887x");
Irrelevant whitespace change.
quoted
  		if (iobase != NULL) {
  			/* write POSIO0R - speed | size | ioport */
  			pci_write_config_dword(dev, ITE_887x_POSIO0,
  				ITE_887x_POSIO_ENABLE | ITE_887x_POSIO_SPEED |
  				ITE_887x_POSIO_IOSIZE_32 | inta_addr[i]);
  			/* write INTCBAR - ioport */
-			pci_write_config_dword(dev, ITE_887x_INTCBAR,
-								inta_addr[i]);
+			pci_write_config_dword(dev, ITE_887x_INTCBAR, inta_addr[i]);
detto
quoted
  			ret = inb(inta_addr[i]);
  			if (ret != 0xff) {
  				/* ioport connected */
  				break;
  			}
  			release_region(iobase->start, ITE_887x_IOSIZE);
-			iobase = NULL;
  		}
-		i++;
I believe with Joe's suggestion I can improve entire body of this branch
perhaps in a separate patch. Do you prefer one or two patches?
quoted
  	if (!inta_addr[i]) {
OOB access?
Yep, Dan reported the same. Missed during conversion. Will fix.

-- 
With Best Regards,
Andy Shevchenko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help