Commit 0bbacb6a authored by Stefan Wahren's avatar Stefan Wahren Committed by Luis Henriques

pinctrl: bcm2835: Fix memory leak in error path

commit 53653c6b upstream.

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: default avatarStefan Wahren <stefan.wahren@i2se.com>
Fixes: e1b2dc70 ("pinctrl: add bcm2835 driver")
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
[ luis: backported to 3.16:
  - file rename: drivers/pinctrl/bcm/pinctrl-bcm2835.c ->
    drivers/pinctrl/pinctrl-bcm2835.c ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 59887677
......@@ -795,7 +795,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment