Commit 52721cfc authored by Wentao Guan's avatar Wentao Guan Committed by Bartosz Golaszewski
Browse files

gpio: regmap: Fix memleak in error path in gpio_regmap_register()



Call gpiochip_remove() to free the resources allocated by
gpiochip_add_data() in error path.

Fixes: 553b75d4 ("gpio: regmap: Allow to allocate regmap-irq device")
Fixes: ae495810 ("gpio: regmap: add the .fixed_direction_output configuration parameter")
CC: stable@vger.kernel.org
Co-developed-by: default avatarWangYuli <wangyl5933@chinaunicom.cn>
Signed-off-by: default avatarWangYuli <wangyl5933@chinaunicom.cn>
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20251204101303.30353-1-guanwentao@uniontech.com


[Bartosz: reworked the commit message]
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
parent 7d80e248
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -338,7 +338,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