Commit 6dc0048c authored by Arvind Yadav's avatar Arvind Yadav Committed by Linus Walleij

gpio: davinci: Handle return value of clk_prepare_enable

clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent f37e335f
...@@ -437,6 +437,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) ...@@ -437,6 +437,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
{ {
unsigned gpio, bank; unsigned gpio, bank;
int irq; int irq;
int ret;
struct clk *clk; struct clk *clk;
u32 binten = 0; u32 binten = 0;
unsigned ngpio, bank_irq; unsigned ngpio, bank_irq;
...@@ -480,12 +481,15 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) ...@@ -480,12 +481,15 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
PTR_ERR(clk)); PTR_ERR(clk));
return PTR_ERR(clk); return PTR_ERR(clk);
} }
clk_prepare_enable(clk); ret = clk_prepare_enable(clk);
if (ret)
return ret;
if (!pdata->gpio_unbanked) { if (!pdata->gpio_unbanked) {
irq = devm_irq_alloc_descs(dev, -1, 0, ngpio, 0); irq = devm_irq_alloc_descs(dev, -1, 0, ngpio, 0);
if (irq < 0) { if (irq < 0) {
dev_err(dev, "Couldn't allocate IRQ numbers\n"); dev_err(dev, "Couldn't allocate IRQ numbers\n");
clk_disable_unprepare(clk);
return irq; return irq;
} }
...@@ -494,6 +498,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) ...@@ -494,6 +498,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
chips); chips);
if (!irq_domain) { if (!irq_domain) {
dev_err(dev, "Couldn't register an IRQ domain\n"); dev_err(dev, "Couldn't register an IRQ domain\n");
clk_disable_unprepare(clk);
return -ENODEV; return -ENODEV;
} }
} }
...@@ -562,8 +567,10 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev) ...@@ -562,8 +567,10 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
sizeof(struct sizeof(struct
davinci_gpio_irq_data), davinci_gpio_irq_data),
GFP_KERNEL); GFP_KERNEL);
if (!irqdata) if (!irqdata) {
clk_disable_unprepare(clk);
return -ENOMEM; return -ENOMEM;
}
irqdata->regs = g; irqdata->regs = g;
irqdata->bank_num = bank; irqdata->bank_num = bank;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment