From: Wentao Guan <guanwentao@uniontech.com>
To: brgl@kernel.org
Cc: andriy.shevchenko@linux.intel.com,
mathieu.dubois-briand@bootlin.com, ioana.ciornei@nxp.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
zhanjun@uniontech.com, niecheng1@uniontech.com,
Wentao Guan <guanwentao@uniontech.com>,
stable@vger.kernel.org, WangYuli <wangyl5933@chinaunicom.cn>
Subject: [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register
Date: Thu, 4 Dec 2025 18:13:04 +0800 [thread overview]
Message-ID: <20251204101303.30353-1-guanwentao@uniontech.com> (raw)
We should call gpiochip_remove(chip) to free the resource
alloced by gpiochip_add_data(chip, gpio) after the err path.
Fixes: 553b75d4bfe9 ("gpio: regmap: Allow to allocate regmap-irq device")
Fixes: ae495810cffe ("gpio: regmap: add the .fixed_direction_output configuration parameter")
CC: stable@vger.kernel.org
Co-developed-by: WangYuli <wangyl5933@chinaunicom.cn>
Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
---
changelog in v3:
Add dependency fixes tag which suggested by Andy Shevchenko.
changelog in v2:
1. format commit message.
2. rebase to mainline now.
---
---
drivers/gpio/gpio-regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index f4267af00027e..c64805dcb9f88 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -328,7 +328,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
config->regmap_irq_line, config->regmap_irq_flags,
0, config->regmap_irq_chip, &gpio->irq_chip_data);
if (ret)
- goto err_free_bitmap;
+ goto err_remove_gpiochip;
irq_domain = regmap_irq_get_domain(gpio->irq_chip_data);
} else
--
2.20.1
next reply other threads:[~2025-12-04 10:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 10:13 Wentao Guan [this message]
2025-12-04 12:09 ` Andy Shevchenko
2025-12-05 8:33 ` 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=20251204101303.30353-1-guanwentao@uniontech.com \
--to=guanwentao@uniontech.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=ioana.ciornei@nxp.com \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=niecheng1@uniontech.com \
--cc=stable@vger.kernel.org \
--cc=wangyl5933@chinaunicom.cn \
--cc=zhanjun@uniontech.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®