Skip to content

Commit 3bd44ed

Browse files
IoanaCiorneiBartosz Golaszewski
authored andcommitted
gpio: regmap: fix memory leak of gpio_regmap structure
The gpio_regmap structure is leaked on the error path. Fix this by jumping to the appropriate kfree instead of returning directly. Fixes: db30516 ("gpio: regmap: Allow ngpio to be read from the property") Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Suggested-by: Michael Walle <mwalle@kernel.org> Reviewed-by: Michael Walle <mwalle@kernel.org> Link: https://lore.kernel.org/r/20250922142427.3310221-7-ioana.ciornei@nxp.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
1 parent c6ccc4d commit 3bd44ed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpio/gpio-regmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
274274
if (!chip->ngpio) {
275275
ret = gpiochip_get_ngpios(chip, chip->parent);
276276
if (ret)
277-
return ERR_PTR(ret);
277+
goto err_free_gpio;
278278
}
279279

280280
/* if not set, assume there is only one register */

0 commit comments

Comments
 (0)