pinctrl: pistachio: Drop pinctrl_unregister for devm_ registered device
authorWei Yongjun <weiyj.lk@gmail.com>
Tue, 26 Jul 2016 14:52:57 +0000 (14:52 +0000)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 10 Aug 2016 13:45:54 +0000 (15:45 +0200)
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>
drivers/pinctrl/pinctrl-pistachio.c

index c6d410ef8de08ec9bdaf6ee9ce803f1879b288a1..7bad200bd67c5cd4801c4098cac5421d9e02f24f 100644 (file)
@@ -1432,7 +1432,6 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev)
 {
        struct pistachio_pinctrl *pctl;
        struct resource *res;
-       int ret;
 
        pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
        if (!pctl)
@@ -1464,13 +1463,7 @@ static int pistachio_pinctrl_probe(struct platform_device *pdev)
                return PTR_ERR(pctl->pctldev);
        }
 
-       ret = pistachio_gpio_register(pctl);
-       if (ret < 0) {
-               pinctrl_unregister(pctl->pctldev);
-               return ret;
-       }
-
-       return 0;
+       return pistachio_gpio_register(pctl);
 }
 
 static struct platform_driver pistachio_pinctrl_driver = {