summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2013-11-13 21:20:39 +0100
committerLinus Walleij <linus.walleij@linaro.org>2013-11-25 09:03:13 +0100
commit61c6375d55235e67d15b4a12cfe90d02710cef5e (patch)
tree720619565a7c01ffd9a9cd89f13b45f983d4ac39 /drivers
parentgpio: rcar: NULL dereference on error in probe() (diff)
downloadlinux-61c6375d55235e67d15b4a12cfe90d02710cef5e.tar.xz
linux-61c6375d55235e67d15b4a12cfe90d02710cef5e.zip
gpio: fix memory leak in error path
Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpiolib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 490198365ce4..14ab16fbaad5 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -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);