[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZN5B89MpyjKxDKVP@smile.fi.intel.com>
Date: Thu, 17 Aug 2023 18:51:15 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Yann Sionneau <yann@...nneau.net>
Cc: Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
Yann Sionneau <ysionneau@...ray.eu>,
Jonathan Borne <jborne@...ray.eu>
Subject: Re: [PATCH 2/2] i2c: designware: abort the transfer if receiving
byte count of 0
On Thu, Aug 17, 2023 at 04:42:05PM +0200, Yann Sionneau wrote:
> Le 11/08/2023 à 16:01, Andy Shevchenko a écrit :
> > On Fri, Aug 11, 2023 at 02:46:24PM +0200, Yann Sionneau wrote:
...
> > > + if ((tmp <= I2C_SMBUS_BLOCK_MAX) && (tmp != 0))
> > if (tmp && tmp <= I2C_SMBUS_BLOCK_MAX)
>
> I find the tmp != 0 "more obvious", I am more used to "just tmp" when it's a
> pointer or a boolean, but maybe it's just me!
>
> I'll fix that in the V2 :)
IIRC it's unsigned, so you may use
if (tmp > 0 && tmp <= I2C_SMBUS_BLOCK_MAX)
which will be more explicit.
> > > + len = i2c_dw_recv_len(dev, tmp);
> > > + else
> > > + i2c_dw_abort(dev);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists