pinctrl: meson: Drop pinctrl_unregister for devm_ registered device
authorWei Yongjun <weiyj.lk@gmail.com>
Tue, 26 Jul 2016 14:51:58 +0000 (14:51 +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.

Fixes: e649f7ec8c5f ("pinctrl: meson: Use devm_pinctrl_register() for pinctrl registration")
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/meson/pinctrl-meson.c

index 11623c6b0cb30270ea267068b495d3227dcf3d96..44e69c963f5da21ea63a9e558aca58aaebc3134c 100644 (file)
@@ -727,13 +727,7 @@ static int meson_pinctrl_probe(struct platform_device *pdev)
                return PTR_ERR(pc->pcdev);
        }
 
-       ret = meson_gpiolib_register(pc);
-       if (ret) {
-               pinctrl_unregister(pc->pcdev);
-               return ret;
-       }
-
-       return 0;
+       return meson_gpiolib_register(pc);
 }
 
 static struct platform_driver meson_pinctrl_driver = {