GPIO: clps711x: use platform_device_unregister in gpio_clps711x_init()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Fri, 26 Oct 2012 15:15:05 +0000 (23:15 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Sat, 27 Oct 2012 16:17:30 +0000 (18:17 +0200)
platform_device_unregister() only calls platform_device_del() and
platform_device_put(), thus use platform_device_unregister() to
simplify the code.

Also the documents in platform.c shows that platform_device_del
and platform_device_put must _only_ be externally called in error
cases.  All other usage is a bug.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-clps711x.c

index ad181db795089dc3e69bb186fb49acb3e176eb1f..ce63b75b13f5ae1eb9869d499862668222b8a2fe 100644 (file)
@@ -162,8 +162,7 @@ static int __init gpio_clps711x_init(void)
                            GFP_KERNEL);
        if (!gpio) {
                dev_err(&pdev->dev, "GPIO allocating memory error\n");
-               platform_device_del(pdev);
-               platform_device_put(pdev);
+               platform_device_unregister(pdev);
                return -ENOMEM;
        }