lkml.org 
[lkml]   [2023]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2023-08-17 17:53    [W:0.040 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site