Skip to content

Commit

Permalink
gpio: fix memory leak in error path
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Michal Nazarewicz authored and Linus Walleij committed Nov 25, 2013
1 parent 0c8aab8 commit 61c6375
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,8 +1354,10 @@ int gpiochip_add_pingroup_range(struct gpio_chip *chip,
ret = pinctrl_get_group_pins(pctldev, pin_group,
&pin_range->range.pins,
&pin_range->range.npins);
if (ret < 0)
if (ret < 0) {
kfree(pin_range);
return ret;
}

pinctrl_add_gpio_range(pctldev, &pin_range->range);

Expand Down

0 comments on commit 61c6375

Please sign in to comment.