mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 00:20:32 +00:00
gpio/omap: free irq domain in probe() failure paths
Currently the IRQ domain is not freed once allocated, in the case where omap_gpio_probe() fails. Therefore, ensure we free the domain if the probe does fail. Furthermore, the local variable "ret" is not needed and so remove this. Signed-off-by: Jon Hunter <jon-hunter@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Reviewed-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
2b78f1e138
commit
879fe32438
1 changed files with 4 additions and 2 deletions
|
@ -1094,7 +1094,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
|
||||||
const struct omap_gpio_platform_data *pdata;
|
const struct omap_gpio_platform_data *pdata;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
struct gpio_bank *bank;
|
struct gpio_bank *bank;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
match = of_match_device(of_match_ptr(omap_gpio_match), dev);
|
match = of_match_device(of_match_ptr(omap_gpio_match), dev);
|
||||||
|
|
||||||
|
@ -1143,18 +1142,21 @@ static int omap_gpio_probe(struct platform_device *pdev)
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (unlikely(!res)) {
|
if (unlikely(!res)) {
|
||||||
dev_err(dev, "Invalid mem resource\n");
|
dev_err(dev, "Invalid mem resource\n");
|
||||||
|
irq_domain_remove(bank->domain);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!devm_request_mem_region(dev, res->start, resource_size(res),
|
if (!devm_request_mem_region(dev, res->start, resource_size(res),
|
||||||
pdev->name)) {
|
pdev->name)) {
|
||||||
dev_err(dev, "Region already claimed\n");
|
dev_err(dev, "Region already claimed\n");
|
||||||
|
irq_domain_remove(bank->domain);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
bank->base = devm_ioremap(dev, res->start, resource_size(res));
|
bank->base = devm_ioremap(dev, res->start, resource_size(res));
|
||||||
if (!bank->base) {
|
if (!bank->base) {
|
||||||
dev_err(dev, "Could not ioremap\n");
|
dev_err(dev, "Could not ioremap\n");
|
||||||
|
irq_domain_remove(bank->domain);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1180,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
list_add_tail(&bank->node, &omap_gpio_list);
|
list_add_tail(&bank->node, &omap_gpio_list);
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_OMAP2PLUS
|
#ifdef CONFIG_ARCH_OMAP2PLUS
|
||||||
|
|
Loading…
Reference in a new issue