* [PATCH v2] gpio: regmap: Fix memleak in gpio_remap_register
@ 2025-12-03 14:15 Wentao Guan
2025-12-03 14:50 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Wentao Guan @ 2025-12-03 14:15 UTC (permalink / raw)
To: brgl
Cc: andriy.shevchenko, mathieu.dubois-briand, ioana.ciornei,
linux-gpio, linux-kernel, zhanjun, niecheng1, Wentao Guan, stable,
WangYuli
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")
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 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
base-commit: 3f9f0252130e7dd60d41be0802bf58f6471c691d
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] gpio: regmap: Fix memleak in gpio_remap_register
2025-12-03 14:15 [PATCH v2] gpio: regmap: Fix memleak in gpio_remap_register Wentao Guan
@ 2025-12-03 14:50 ` Andy Shevchenko
2025-12-03 15:12 ` Wentao Guan
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2025-12-03 14:50 UTC (permalink / raw)
To: Wentao Guan
Cc: brgl, mathieu.dubois-briand, ioana.ciornei, linux-gpio,
linux-kernel, zhanjun, niecheng1, stable, WangYuli
On Wed, Dec 03, 2025 at 10:15:58PM +0800, Wentao Guan wrote:
> 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")
As I told in v1, add the other Fixes tag, to show that the code was modified
and this change has a dependency to that.
...
With that done, it LGTM.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] gpio: regmap: Fix memleak in gpio_remap_register
2025-12-03 14:50 ` Andy Shevchenko
@ 2025-12-03 15:12 ` Wentao Guan
2025-12-03 16:58 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Wentao Guan @ 2025-12-03 15:12 UTC (permalink / raw)
To: Andy Shevchenko
Cc: brgl, mathieu.dubois-briand, Ioana Ciornei, linux-gpio,
linux-kernel, 占俊, 聂诚, stable,
WangYuli
Hello Andy:
I did not found ae495810cffe ,thought it is that:
Fixes: 00aaae60faf5 ("gpio: regmap: add the .fixed_direction_output configuration parameter"),
I will add it to v3.
BRs
Wentao Guan
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] gpio: regmap: Fix memleak in gpio_remap_register
2025-12-03 15:12 ` Wentao Guan
@ 2025-12-03 16:58 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-12-03 16:58 UTC (permalink / raw)
To: Wentao Guan
Cc: brgl, mathieu.dubois-briand, Ioana Ciornei, linux-gpio,
linux-kernel, 占俊, 聂诚, stable,
WangYuli
On Wed, Dec 03, 2025 at 11:12:39PM +0800, Wentao Guan wrote:
> Hello Andy:
>
> I did not found ae495810cffe ,thought it is that:
> Fixes: 00aaae60faf5 ("gpio: regmap: add the .fixed_direction_output configuration parameter"),
> I will add it to v3.
No, please don't. This is wrong.
$ git tag --contains ae495810cffe
next-20251022
...
$ git branch -a --contains ae495810cffe | grep gpio
remotes/brgl/gpio/for-current
remotes/brgl/gpio/for-next
So it will be part of v6.19-rc1, which means your patch should be based
on that three.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-03 16:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-03 14:15 [PATCH v2] gpio: regmap: Fix memleak in gpio_remap_register Wentao Guan
2025-12-03 14:50 ` Andy Shevchenko
2025-12-03 15:12 ` Wentao Guan
2025-12-03 16:58 ` Andy Shevchenko
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).