From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH 2/2] gpio: fix cleanup path on hog failure
Date: Tue, 09 Jun 2026 14:17:50 +0200 [thread overview]
Message-ID: <20260609-gpio-hogs-fixes-v1-2-b4064f8070e7@oss.qualcomm.com> (raw)
In-Reply-To: <20260609-gpio-hogs-fixes-v1-0-b4064f8070e7@oss.qualcomm.com>
If gpiochip_hog_lines() successfully processes some hogs but fails on
a later one, the error handling path in gpiochip_add_data_with_key()
jumps directly to err_remove_of_chip. This leaks resources allocated
earlier for ACPI, interrupts and hogs that were successfully processed.
Use the right label in error path.
Closes: https://sashiko.dev/#/patchset/20260608210108.36248-1-dan%40reactivated.net
Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 1fc7ee9e1158d21f7c75e6cb95c33f0af44835c8..0cd79906d95c60035db1f6adc49bcfcfd3cc751b 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1316,7 +1316,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
ret = gpiochip_hog_lines(gc);
if (ret)
- goto err_remove_of_chip;
+ goto err_free_hogs;
ret = gpiochip_irqchip_init_valid_mask(gc);
if (ret)
--
2.47.3
next prev parent reply other threads:[~2026-06-09 12:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 12:17 [PATCH 0/2] gpio: fix regressions in GPIO hogs after the code refactoring Bartosz Golaszewski
2026-06-09 12:17 ` [PATCH 1/2] gpio: don't process hogs on disabled nodes Bartosz Golaszewski
2026-06-09 14:16 ` Andy Shevchenko
2026-06-09 14:33 ` Bartosz Golaszewski
2026-06-09 12:17 ` Bartosz Golaszewski [this message]
2026-06-09 14:25 ` [PATCH 2/2] gpio: fix cleanup path on hog failure Andy Shevchenko
2026-06-09 14:33 ` Bartosz Golaszewski
2026-06-09 14:50 ` Andy Shevchenko
2026-06-09 12:47 ` [PATCH 0/2] gpio: fix regressions in GPIO hogs after the code refactoring Mika Westerberg
2026-06-10 7:30 ` (subset) " 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=20260609-gpio-hogs-fixes-v1-2-b4064f8070e7@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.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
all inboxes | Powered by JetHome®