History

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.

Ioana Ciornei committed 1 year ago

Commit 3bd44ed1 parent c6ccc4d1 file · +1 −1Browse files

Unified · Split

drivers/gpio/gpio-regmap.c+1−1
@@ -274,7 +274,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config · 273 unmodified lines
274 if (!chip->ngpio) {274 if (!chip->ngpio) {
275 ret = gpiochip_get_ngpios(chip, chip->parent);275 ret = gpiochip_get_ngpios(chip, chip->parent);
276 if (ret)276 if (ret)
277 return ERR_PTR(ret);277 goto err_free_gpio;
278 }278 }
279 279
280 /* if not set, assume there is only one register */280 /* if not set, assume there is only one register */