Re: [PATCH 13/18] serial: sc16is7xx: use in_range() for DT properties bound checks

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

 



On Tue, Dec 19, 2023 at 12:18:57PM -0500, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
> 
> Improve code readability and efficiency by using in_range() when checking
> device tree properties bound.

...

>  	count = device_property_count_u32(dev, "irda-mode-ports");
> -	if (count < 0 || count > SC16IS7XX_MAX_PORTS)
> +	if (!in_range(count, 0, SC16IS7XX_MAX_PORTS + 1))
>  		return;

Okay, looking at this, it becomes uglier than initial code,
means my suggestion was not good. Please, drop this patch.

-- 
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