pinctrl: st: remove gpiochip in failure cases
authorPramod Gurav <pramod.gurav@smartplayin.com>
Tue, 9 Sep 2014 07:51:40 +0000 (13:21 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 23 Sep 2014 14:53:18 +0000 (16:53 +0200)
This patch releases gpiochip related resources by calling
gpiochip_remove when gpiochip_irqchip_add fails.

Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-st.c

index 6c4c41bed1e3d8893fcd3e7e3b0cf539647d5ad5..4b1792aad3d87469b38046da4f7fdbda191cfd5c 100644 (file)
@@ -1517,6 +1517,7 @@ static int st_gpiolib_register_bank(struct st_pinctrl *info,
                                           0, handle_simple_irq,
                                           IRQ_TYPE_LEVEL_LOW);
                if (err) {
+                       gpiochip_remove(&bank->gpio_chip);
                        dev_info(dev, "could not add irqchip\n");
                        return err;
                }