mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 07:44:49 +01:00
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: db30516188 ("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>
This commit is contained in:
parent
c6ccc4dde1
commit
3bd44edd6c
1 changed files with 1 additions and 1 deletions
|
|
@ -274,7 +274,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
|
|||
if (!chip->ngpio) {
|
||||
ret = gpiochip_get_ngpios(chip, chip->parent);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
goto err_free_gpio;
|
||||
}
|
||||
|
||||
/* if not set, assume there is only one register */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue