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

From: Andy Shevchenko
Date: Wed Dec 20 2023 - 10:55:07 EST


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