The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Kent Gibson <warthog618@gmail.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH] gpiolib: fix reference leaks when removing GPIO chips still in use
Date: Thu, 10 Aug 2023 18:19:17 +0300	[thread overview]
Message-ID: <ZNT/9WqW4c0FwVlw@smile.fi.intel.com> (raw)
In-Reply-To: <ZNT/hvkZswZsZUFU@smile.fi.intel.com>

On Thu, Aug 10, 2023 at 06:17:26PM +0300, Andy Shevchenko wrote:
> On Thu, Aug 10, 2023 at 12:03:34PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

...

> >  void gpiod_free(struct gpio_desc *desc)
> >  {
> > -	if (desc && desc->gdev && gpiod_free_commit(desc)) {
> > -		module_put(desc->gdev->owner);
> > -		gpio_device_put(desc->gdev);
> > -	} else {
> > +	if (!desc)
> > +		return;

> 	VALIDATE_DESC_VOID() ?

If it is not possible to use, the comment should be added, like we have in
gpiod_to_irq().

> > +	if (!gpiod_free_commit(desc))
> >  		WARN_ON(extra_checks);
> > -	}
> > +
> > +	gpio_device_put(desc->gdev);
> > +	module_put(desc->gdev->owner);
> >  }

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2023-08-10 15:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 10:03 [PATCH] gpiolib: fix reference leaks when removing GPIO chips still in use Bartosz Golaszewski
2023-08-10 11:46 ` Linus Walleij
2023-08-10 15:17 ` Andy Shevchenko
2023-08-10 15:19   ` 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=ZNT/9WqW4c0FwVlw@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 \
    --cc=warthog618@gmail.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