From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Cezar Chiru <chiru.cezar.89@gmail.com>
Cc: andi.shyti@kernel.org, wsa+renesas@sang-engineering.com,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 1/1] i2c: pcf8584: Move 'ret' variable inside for loop, break if ret < 0.
Date: Thu, 23 Oct 2025 08:23:54 +0200 [thread overview]
Message-ID: <aPnJ-inBznSQQPo0@black.igk.intel.com> (raw)
In-Reply-To: <20251022015213.6988-2-chiru.cezar.89@gmail.com>
On Wed, Oct 22, 2025 at 04:52:13AM +0300, Cezar Chiru wrote:
> Require spaces around '=' and '<'. Add spaces around binary operators.
> Enforce error fixing based on checkpatch.pl output on file.
> Move 'ret' variable inside for loop. Then check if (ret < 0) break. This
> improves usage of ret variable.
No need to have a cover letter for a single patch.
> Signed-off-by: Cezar Chiru <chiru.cezar.89@gmail.com>
> ---
You may use this comment block space for changelog and additional comments if
required.
...
> goto out;
> }
>
> - for (i = 0;ret >= 0 && i < num; i++) {
> - pmsg = &msgs[i];
> + for (i = 0; i < num; i++) {
> + int ret;
>
> + pmsg = &msgs[i];
> ret = pcf_doAddress(adap, pmsg);
>
> /* Send START */
> ret = pcf_sendbytes(i2c_adap, pmsg->buf, pmsg->len,
> (i + 1 == num));
> }
> +
> + if (ret < 0)
> + break;
I think goto out; is better as it's kept consistent with other error path branches above.
> }
>
> out:
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-10-23 6:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 1:52 [PATCH v8 0/1] Improve usage of 'ret' variable Cezar Chiru
2025-10-22 1:52 ` [PATCH v8 1/1] i2c: pcf8584: Move 'ret' variable inside for loop, break if ret < 0 Cezar Chiru
2025-10-23 6:23 ` Andy Shevchenko [this message]
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=aPnJ-inBznSQQPo0@black.igk.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andi.shyti@kernel.org \
--cc=chiru.cezar.89@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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;
as well as URLs for NNTP newsgroup(s).