aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPramod Gurav <pramod.gurav@smartplayin.com>2014-09-09 06:20:37 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-23 10:46:47 -0400
commit834e1678649db1e064ee397cca161a65bacfa801 (patch)
tree578f7ec483d3d97cce2b029cb9cfd7bdc2b1e78d
parent70e4197420a154a2a684b6e7b496dda70b20d9ec (diff)
pinctrl: at91: Fix error handling while doing gpiochio_irqchip_add
This patch removes a call to panic function when gpiochio_irqchip_add fails and just returns the error to the calling function. Same return value is used to handle the error case and adds a lable to release resources on error. The error message has been improved to indicate failure to add irqchip to gpiochip. This also changes first argument to function at91_gpio_of_irq_setup from struct device_node to struct platform_device. Because The device_node argument was anyway not being used. Passed pdev so that on failure dev_err can use &pdev->dev and log can be associated with proper device. CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> 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>
-rw-r--r--drivers/pinctrl/pinctrl-at91.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 71a8e8c4f19c..51d094cc3f10 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -1605,7 +1605,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
1605 /* now it may re-trigger */ 1605 /* now it may re-trigger */
1606} 1606}
1607 1607
1608static int at91_gpio_of_irq_setup(struct device_node *node, 1608static int at91_gpio_of_irq_setup(struct platform_device *pdev,
1609 struct at91_gpio_chip *at91_gpio) 1609 struct at91_gpio_chip *at91_gpio)
1610{ 1610{
1611 struct at91_gpio_chip *prev = NULL; 1611 struct at91_gpio_chip *prev = NULL;
@@ -1630,9 +1630,11 @@ static int at91_gpio_of_irq_setup(struct device_node *node,
1630 0, 1630 0,
1631 handle_edge_irq, 1631 handle_edge_irq,
1632 IRQ_TYPE_EDGE_BOTH); 1632 IRQ_TYPE_EDGE_BOTH);
1633 if (ret) 1633 if (ret) {
1634 panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n", 1634 dev_err(&pdev->dev, "at91_gpio.%d: Couldn't add irqchip to gpiochip.\n",
1635 at91_gpio->pioc_idx); 1635 at91_gpio->pioc_idx);
1636 return ret;
1637 }
1636 1638
1637 /* Setup chained handler */ 1639 /* Setup chained handler */
1638 if (at91_gpio->pioc_idx) 1640 if (at91_gpio->pioc_idx)
@@ -1800,12 +1802,16 @@ static int at91_gpio_probe(struct platform_device *pdev)
1800 1802
1801 at91_gpio_probe_fixup(); 1803 at91_gpio_probe_fixup();
1802 1804
1803 at91_gpio_of_irq_setup(np, at91_chip); 1805 ret = at91_gpio_of_irq_setup(pdev, at91_chip);
1806 if (ret)
1807 goto irq_setup_err;
1804 1808
1805 dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase); 1809 dev_info(&pdev->dev, "at address %p\n", at91_chip->regbase);
1806 1810
1807 return 0; 1811 return 0;
1808 1812
1813irq_setup_err:
1814 gpiochip_remove(chip);
1809gpiochip_add_err: 1815gpiochip_add_err:
1810 clk_disable(at91_chip->clock); 1816 clk_disable(at91_chip->clock);
1811clk_enable_err: 1817clk_enable_err: