[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231220112413.c6f96dbb438df63a5e5f08a0@hugovil.com>
Date: Wed, 20 Dec 2023 11:24:13 -0500
From: Hugo Villeneuve <hugo@...ovil.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: gregkh@...uxfoundation.org, jirislaby@...nel.org, jringle@...dpoint.com,
kubakici@...pl, phil@...pberrypi.org, bo.svangard@...eddedart.se,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org, Hugo Villeneuve
<hvilleneuve@...onoff.com>
Subject: Re: [PATCH 13/18] serial: sc16is7xx: use in_range() for DT
properties bound checks
On Wed, 20 Dec 2023 17:54:07 +0200
Andy Shevchenko <andy.shevchenko@...il.com> wrote:
> On Tue, Dec 19, 2023 at 12:18:57PM -0500, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@...onoff.com>
> >
> > 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.
Ok, will drop it for V2.
Hugo Villeneuve
Powered by blists - more mailing lists