diff options
author | Wei Yongjun <weiyj.lk@gmail.com> | 2016-07-26 10:52:57 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-08-10 09:45:54 -0400 |
commit | b120a3c286520ca465c54e8afa442be10560053b (patch) | |
tree | 43a04f4d04a18212d041c97f86abc569cc556ced | |
parent | 5b236d0fde21d88351420ef0b9a6cb7aeeea0c54 (diff) |
pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device
It's not necessary to unregister pin controller device registered
with devm_pinctrl_register() and using pinctrl_unregister() leads
to a double free.
This is detected by Coccinelle semantic patch.
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-pistachio.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c index c6d410ef8de0..7bad200bd67c 100644 --- a/drivers/pinctrl/pinctrl-pistachio.c +++ b/drivers/pinctrl/pinctrl-pistachio.c | |||
@@ -1432,7 +1432,6 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev) | |||
1432 | { | 1432 | { |
1433 | struct pistachio_pinctrl *pctl; | 1433 | struct pistachio_pinctrl *pctl; |
1434 | struct resource *res; | 1434 | struct resource *res; |
1435 | int ret; | ||
1436 | 1435 | ||
1437 | pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); | 1436 | pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); |
1438 | if (!pctl) | 1437 | if (!pctl) |
@@ -1464,13 +1463,7 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev) | |||
1464 | return PTR_ERR(pctl->pctldev); | 1463 | return PTR_ERR(pctl->pctldev); |
1465 | } | 1464 | } |
1466 | 1465 | ||
1467 | ret = pistachio_gpio_register(pctl); | 1466 | return pistachio_gpio_register(pctl); |
1468 | if (ret < 0) { | ||
1469 | pinctrl_unregister(pctl->pctldev); | ||
1470 | return ret; | ||
1471 | } | ||
1472 | |||
1473 | return 0; | ||
1474 | } | 1467 | } |
1475 | 1468 | ||
1476 | static struct platform_driver pistachio_pinctrl_driver = { | 1469 | static struct platform_driver pistachio_pinctrl_driver = { |