Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org
Subject: Re: [PATCH] gpio: gpiolib: fix refcount imbalance in gpiochip_setup_dev()
Date: Thu, 5 Dec 2024 15:20:50 +0200	[thread overview]
Message-ID: <Z1GoskmQH0_FhxID@black.fi.intel.com> (raw)
In-Reply-To: <20241204122152.1312051-1-joe@pf.is.s.u-tokyo.ac.jp>

On Wed, Dec 04, 2024 at 09:21:52PM +0900, Joe Hattori wrote:
> In gpiochip_setup_dev(), the refcount incremented in device_initialize()
> is not decremented in the error path. Fix it by calling put_device().

First of all, we have gpio_put_device().
Second, what the problem do you have in practice? Can you show any backtrace?
Third, how had this change been tested?

Looking at the current code I noticed the following:
1) gpiochip_add_data_with_key() has already that call;
2) gpiochip_setup_devs() misses that call.

This effectively means that you inroduce a regression while fixing a bug.

The GPIO device initialisation is non-trivial, please pay more attention to the
code.

Bart, can this be removed or reverted before it poisons stable?

-- 
With Best Regards,
Andy Shevchenko



  parent reply	other threads:[~2024-12-05 13:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 12:21 [PATCH] gpio: gpiolib: fix refcount imbalance in gpiochip_setup_dev() Joe Hattori
2024-12-04 17:09 ` Linus Walleij
2024-12-05 12:09 ` Bartosz Golaszewski
2024-12-05 13:20 ` Andy Shevchenko [this message]
2024-12-05 13:23   ` Andy Shevchenko
2024-12-05 13:30   ` Bartosz Golaszewski
2024-12-06  8:53     ` Joe Hattori
2024-12-06 15:40       ` Andy Shevchenko
2024-12-17 14:50       ` Dan Carpenter

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=Z1GoskmQH0_FhxID@black.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=brgl@bgdev.pl \
    --cc=joe@pf.is.s.u-tokyo.ac.jp \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@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