From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Linus Walleij <linusw@kernel.org>, Bartosz Golaszewski <brgl@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH 3/4] gpio: shared: fix auxiliary device cleanup order
Date: Sat, 06 Dec 2025 12:53:55 +0100 [thread overview]
Message-ID: <20251206-gpio-shared-teardown-fixes-v1-3-35ac458cfce1@oss.qualcomm.com> (raw)
In-Reply-To: <20251206-gpio-shared-teardown-fixes-v1-0-35ac458cfce1@oss.qualcomm.com>
Dropping the last reference to the internal struct device should be the
last thing we do so delete the device first and then uninit it which
also involves the final put_device().
Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/gpio/gpiolib-shared.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib-shared.c b/drivers/gpio/gpiolib-shared.c
index 4084a28a953a7c9f4b04cbf867b05a1a74b557ca..2d3b0c3460e56941af8415af6989914104060bf7 100644
--- a/drivers/gpio/gpiolib-shared.c
+++ b/drivers/gpio/gpiolib-shared.c
@@ -415,8 +415,8 @@ static void gpio_shared_remove_adev(struct auxiliary_device *adev)
{
lockdep_assert_held(&gpio_shared_lock);
- auxiliary_device_uninit(adev);
auxiliary_device_delete(adev);
+ auxiliary_device_uninit(adev);
}
int gpio_device_setup_shared(struct gpio_device *gdev)
--
2.51.0
next prev parent reply other threads:[~2025-12-06 11:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 11:53 [PATCH 0/4] gpio: shared: fix some bugs in unregister and error paths Bartosz Golaszewski
2025-12-06 11:53 ` [PATCH 1/4] gpio: shared: fix NULL-pointer dereference in teardown path Bartosz Golaszewski
2025-12-06 11:53 ` [PATCH 2/4] gpio: shared: check if a reference is populated before cleaning its resources Bartosz Golaszewski
2025-12-06 11:53 ` Bartosz Golaszewski [this message]
2025-12-06 11:53 ` [PATCH 4/4] gpio: shared: make locking more fine-grained Bartosz Golaszewski
2025-12-09 6:19 ` [PATCH 0/4] gpio: shared: fix some bugs in unregister and error paths Bartosz Golaszewski
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=20251206-gpio-shared-teardown-fixes-v1-3-35ac458cfce1@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linusw@kernel.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;
as well as URLs for NNTP newsgroup(s).