summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/core.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-09-25 11:11:40 +0400
committerLinus Walleij <linus.walleij@linaro.org>2012-09-27 15:43:14 +0400
commiteb26cc9c71f81f44777bbf5ca1bd72aa76997786 (patch)
treeaf7b8314a9b325b7b13f7adda05a9739dc8d4089 /drivers/pinctrl/core.c
parent4c854723c8bea457d3418ea2f398b6cfbcb3988e (diff)
downloadlinux-eb26cc9c71f81f44777bbf5ca1bd72aa76997786.tar.xz
pinctrl: Fix potential memory leak in pinctrl_register_one_pin()
'pindesc' was not freed when returning from an error induced exit path. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.c')
-rw-r--r--drivers/pinctrl/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index dc5c126e398a..0f1ec9e8ff14 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -230,8 +230,10 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
pindesc->name = name;
} else {
pindesc->name = kasprintf(GFP_KERNEL, "PIN%u", number);
- if (pindesc->name == NULL)
+ if (pindesc->name == NULL) {
+ kfree(pindesc);
return -ENOMEM;
+ }
pindesc->dynamic_name = true;
}