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>
This commit is contained in:
parent
4c854723c8
commit
eb26cc9c71
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue