Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] gpio: regmap: Fix gpio_remap_register
@ 2025-12-03  2:03 Wentao Guan
  2025-12-03 10:04 ` Andy Shevchenko
  2025-12-03 13:46 ` Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Wentao Guan @ 2025-12-03  2:03 UTC (permalink / raw)
  To: andy
  Cc: mathieu.dubois-briand, linux-gpio, linux-kernel, zhanjun,
	niecheng1, Wentao Guan, stable, WangYuli

Because gpiochip_add_data successfully done, use
err_remove_gpiochip instead of err_free_bitmap to free
such as gdev,descs..

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>
---
 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 fd986afa7db5f..f0bcb2c2c6748 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -310,7 +310,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] 4+ messages in thread

* Re: [PATCH] gpio: regmap: Fix gpio_remap_register
  2025-12-03  2:03 [PATCH] gpio: regmap: Fix gpio_remap_register Wentao Guan
@ 2025-12-03 10:04 ` Andy Shevchenko
  2025-12-03 13:51   ` Wentao Guan
  2025-12-03 13:46 ` Bartosz Golaszewski
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2025-12-03 10:04 UTC (permalink / raw)
  To: Wentao Guan, Ioana Ciornei
  Cc: andy, mathieu.dubois-briand, linux-gpio, linux-kernel, zhanjun,
	niecheng1, stable, WangYuli

+Cc: Ioana

On Wed, Dec 03, 2025 at 10:03:42AM +0800, Wentao Guan wrote:
> Because gpiochip_add_data successfully done, use

gpiochip_add_data()

> err_remove_gpiochip instead of err_free_bitmap to free
> such as gdev,descs..

What does 'gdev,desc.' stand for (also notice dot at the end)?

> Fixes: 553b75d4bfe9 ("gpio: regmap: Allow to allocate regmap-irq device")

Perhaps you also want to add this
ae495810cffe ("gpio: regmap: add the .fixed_direction_output configuration parameter")

As the patch changed the logic from the original commit.

Interestingly the 3bd44edd6c55 ("gpio: regmap: fix memory leak of gpio_regmap
structure") fixed one leak and missed this one.

...

> 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

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] gpio: regmap: Fix gpio_remap_register
  2025-12-03  2:03 [PATCH] gpio: regmap: Fix gpio_remap_register Wentao Guan
  2025-12-03 10:04 ` Andy Shevchenko
@ 2025-12-03 13:46 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2025-12-03 13:46 UTC (permalink / raw)
  To: Wentao Guan
  Cc: andy, mathieu.dubois-briand, linux-gpio, linux-kernel, zhanjun,
	niecheng1, stable, WangYuli

On Wed, Dec 3, 2025 at 3:05 AM Wentao Guan <guanwentao@uniontech.com> wrote:
>
> Because gpiochip_add_data successfully done, use
> err_remove_gpiochip instead of err_free_bitmap to free
> such as gdev,descs..
>
> 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>
> ---

Please use get_maintainers.pl - you have not put neither Linus nor I
in the Cc list.

Bart

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

* Re: [PATCH] gpio: regmap: Fix gpio_remap_register
  2025-12-03 10:04 ` Andy Shevchenko
@ 2025-12-03 13:51   ` Wentao Guan
  0 siblings, 0 replies; 4+ messages in thread
From: Wentao Guan @ 2025-12-03 13:51 UTC (permalink / raw)
  To: Andy Shevchenko, Ioana Ciornei
  Cc: andy, mathieu.dubois-briand, linux-gpio, linux-kernel,
	占俊, 聂诚, stable, WangYuli

Hello Andy,

I noticed it in v6.6.117, i fogot rebase it in v6.19-rc1, i will send v2 soon.

PS: The fact is we need to call gpiochip_remove(chip) to free what gpiochip_add_data(chip, gpio) alloc.

BRs
Wentao Guan

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

end of thread, other threads:[~2025-12-03 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-03  2:03 [PATCH] gpio: regmap: Fix gpio_remap_register Wentao Guan
2025-12-03 10:04 ` Andy Shevchenko
2025-12-03 13:51   ` Wentao Guan
2025-12-03 13:46 ` Bartosz Golaszewski

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