Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register
@ 2025-12-04 10:13 Wentao Guan
  2025-12-04 12:09 ` Andy Shevchenko
  2025-12-05  8:33 ` Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Guan @ 2025-12-04 10:13 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")
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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register
  2025-12-04 10:13 [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register Wentao Guan
@ 2025-12-04 12:09 ` Andy Shevchenko
  2025-12-05  8:33 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-12-04 12:09 UTC (permalink / raw)
  To: Wentao Guan
  Cc: brgl, mathieu.dubois-briand, ioana.ciornei, linux-gpio,
	linux-kernel, zhanjun, niecheng1, stable, WangYuli

On Thu, Dec 04, 2025 at 06:13:04PM +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.

Thanks, LGTM now
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register
  2025-12-04 10:13 [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register Wentao Guan
  2025-12-04 12:09 ` Andy Shevchenko
@ 2025-12-05  8:33 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2025-12-05  8:33 UTC (permalink / raw)
  To: brgl, Wentao Guan
  Cc: Bartosz Golaszewski, andriy.shevchenko, mathieu.dubois-briand,
	ioana.ciornei, linux-gpio, linux-kernel, zhanjun, niecheng1,
	stable, WangYuli


On Thu, 04 Dec 2025 18:13:04 +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.
> 
> 

Fixed typos, reworked the commit message and queued for fixes.

[1/1] gpio: regmap: Fix memleak in gpio_remap_register
      https://git.kernel.org/brgl/linux/c/52721cfc78c76b09c66e092b52617006390ae96a

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-05  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-04 10:13 [PATCH v3] gpio: regmap: Fix memleak in gpio_remap_register Wentao Guan
2025-12-04 12:09 ` Andy Shevchenko
2025-12-05  8:33 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox