Re: [PATCH 09/18] serial: sc16is7xx: add macro for max number of UART ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 19, 2023 at 12:18:53PM -0500, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
> 
> Add macro to hold the maximum number of UART ports per IC/device.

...

> -	if (count < 0 || count > ARRAY_SIZE(irda_port))
> +	if (count < 0 || count > SC16IS7XX_MAX_PORTS)

ARRAY_SIZE() is more robust than this. What if you change to support different
devices where this won't be as defined?

>  		return;

...

> -	if (count < 0 || count > ARRAY_SIZE(mctrl_port))
> +	if (count < 0 || count > SC16IS7XX_MAX_PORTS)
>  		return 0;

Ditto.

...

> +	WARN_ON(devtype->nr_uart > SC16IS7XX_MAX_PORTS);

Not sure about this, perhaps it's fine.

Otherwise looks reasonable.

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux