pinctrl: lantiq: Release gpiochip resources in fail case
authorPramod Gurav <pramod.gurav@smartplayin.com>
Tue, 9 Sep 2014 08:05:52 +0000 (13:35 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 23 Sep 2014 10:23:09 +0000 (12:23 +0200)
This patch releases gpiochip resources with of_gpiochip_remove
and gpiochip_remove in failure cases.

CC: John Crispin <blogic@openwrt.org>
CC: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-xway.c

index e66f4cae7633cd41e52f13a252c05be6197b3050..37040ab428900541a3c02c61dfd44662628ddd6c 100644 (file)
@@ -801,6 +801,7 @@ static int pinmux_xway_probe(struct platform_device *pdev)
        of_gpiochip_add(&xway_chip);
        ret = gpiochip_add(&xway_chip);
        if (ret) {
+               of_gpiochip_remove(&xway_chip);
                dev_err(&pdev->dev, "Failed to register gpio chip\n");
                return ret;
        }
@@ -822,6 +823,7 @@ static int pinmux_xway_probe(struct platform_device *pdev)
        /* register with the generic lantiq layer */
        ret = ltq_pinctrl_register(pdev, &xway_info);
        if (ret) {
+               gpiochip_remove(&xway_chip);
                dev_err(&pdev->dev, "Failed to register pinctrl driver\n");
                return ret;
        }