public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] gpiolib: Deduplicate cleanup for-loop in gpiochip_add_data_with_key()
Date: Thu, 22 Feb 2024 15:28:12 +0200	[thread overview]
Message-ID: <ZddL7L24RXoqR7sN@smile.fi.intel.com> (raw)
In-Reply-To: <CAMRc=McECxKW+uS7fQyGtYVfcSZQaAJZFi+s+wNMoRiHxef0zw@mail.gmail.com>

On Thu, Feb 22, 2024 at 10:48:00AM +0100, Bartosz Golaszewski wrote:
> On Wed, Feb 21, 2024 at 8:36 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > There is no need to repeat for-loop twice in the error path in
> > gpiochip_add_data_with_key(). Deduplicate it. While at it,
> > rename loop variable to be more specific and avoid ambguity.
> >
> > It also properly unwinds the SRCU, i.e. in reversed order of allocating.

...

> This doesn't apply on top of gpio/for-next, I think it depends on one
> of your earlier patches?

Yes, on the fix with error path.

...

> > +       while (desc_index--)
> 
> What about gdev->descs[0]?

What about it? :-)

for (i = i - 1; i >= 0; i--)
while (--i >= 0)
while (i--)

are all equivalents.

The difference is what the value will i get _after_ the loop.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-02-22 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 19:36 [PATCH v1 1/1] gpiolib: Deduplicate cleanup for-loop in gpiochip_add_data_with_key() Andy Shevchenko
2024-02-22  9:48 ` Bartosz Golaszewski
2024-02-22 13:28   ` Andy Shevchenko [this message]
2024-02-22 13:30     ` Bartosz Golaszewski
2024-02-22 13:38       ` Andy Shevchenko
2024-02-22 13:40         ` Bartosz Golaszewski
2024-02-22 13:41           ` Andy Shevchenko
2024-03-04 15:15             ` Bartosz Golaszewski
2024-03-04 17:16               ` Andy Shevchenko
2024-02-22 13:40         ` Andy Shevchenko

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=ZddL7L24RXoqR7sN@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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