pinctrl: bcm2835: Fix memory leak in error path
authorStefan Wahren <stefan.wahren@i2se.com>
Mon, 21 Dec 2015 00:44:04 +0000 (00:44 +0000)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 22 Dec 2015 12:50:37 +0000 (13:50 +0100)
In case of an invalid pin value bcm2835_pctl_dt_node_to_map()
would leak the pull configs of already assigned pins.
So avoid this by calling the free map function in error case.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fixes: e1b2dc70cd5b ("pinctrl: add bcm2835 driver")
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/bcm/pinctrl-bcm2835.c

index a1ea565fcd46490e58d48e4363318c2ce6970ebc..f26d374816325286cae67c6bb13ceeebddb811ed 100644 (file)
@@ -794,7 +794,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
        return 0;
 
 out:
-       kfree(maps);
+       bcm2835_pctl_dt_free_map(pctldev, maps, num_pins * maps_per_pin);
        return err;
 }
 
This page took 0.030014 seconds and 5 git commands to generate.