public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Yann Sionneau <yann@sionneau.net>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yann Sionneau <ysionneau@kalray.eu>,
	Jonathan Borne <jborne@kalray.eu>
Subject: Re: [PATCH 2/2] i2c: designware: abort the transfer if receiving byte count of 0
Date: Thu, 17 Aug 2023 18:51:15 +0300	[thread overview]
Message-ID: <ZN5B89MpyjKxDKVP@smile.fi.intel.com> (raw)
In-Reply-To: <d493159f-8656-5777-8f77-c45504397c60@sionneau.net>

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



  reply	other threads:[~2023-08-17 15:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-11 12:46 [PATCH 1/2] i2c: designware: fix __i2c_dw_disable in case master is holding SCL low Yann Sionneau
2023-08-11 12:46 ` [PATCH 2/2] i2c: designware: abort the transfer if receiving byte count of 0 Yann Sionneau
2023-08-11 14:01   ` Andy Shevchenko
2023-08-17 14:42     ` Yann Sionneau
2023-08-17 15:51       ` Andy Shevchenko [this message]
2023-08-11 13:59 ` [PATCH 1/2] i2c: designware: fix __i2c_dw_disable in case master is holding SCL low Andy Shevchenko
2023-08-17 14:39   ` Yann Sionneau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZN5B89MpyjKxDKVP@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jborne@kalray.eu \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=yann@sionneau.net \
    --cc=ysionneau@kalray.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox