[PATCH 3.16.y-ckt 058/135] pinctrl: lantiq: Release gpiochip resources in fail case

From: Luis Henriques
Date: Fri Feb 06 2015 - 07:27:00 EST


3.16.7-ckt6 -stable review patch. If anyone has any objections, please let me know.

------------------

From: Pramod Gurav <pramod.gurav@xxxxxxxxxxxxxxx>

commit 849a8c25c80a2cde824072813bf4aabbc79b8789 upstream.

This patch releases gpiochip resources with of_gpiochip_remove
and gpiochip_remove in failure cases.

CC: John Crispin <blogic@xxxxxxxxxxx>
CC: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Pramod Gurav <pramod.gurav@xxxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Luis Henriques <luis.henriques@xxxxxxxxxxxxx>
---
drivers/pinctrl/pinctrl-xway.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index e66f4cae7633..37040ab42890 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -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;
}
--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/