The gpio_regmap structure is leaked on the error path. Fix this by jumping to the appropriate kfree instead of returning directly.
Unified · Split
| @@ -274,7 +274,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config · 273 unmodified lines | ||
| 274 | 274 | if (!chip->ngpio) { |
| 275 | 275 | ret = gpiochip_get_ngpios(chip, chip->parent); |
| 276 | 276 | if (ret) |
| 277 | − return ERR_PTR(ret); | |
| 277 | + goto err_free_gpio; | |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /* if not set, assume there is only one register */ |