aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2013-04-04 16:16:12 -0400
committerLinus Walleij <linus.walleij@linaro.org>2013-04-10 17:41:16 -0400
commit879fe32438be9ff1ea2cf44e39e11b58206a76b2 (patch)
treed9a45c4e94551ebb068c81054c445ba6ec71af82
parent2b78f1e1389aef263071b9edf41c0980b092e601 (diff)
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>
-rw-r--r--drivers/gpio/gpio-omap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 352f9949c054..0de2e0d71b92 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1094,7 +1094,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
1094 const struct omap_gpio_platform_data *pdata; 1094 const struct omap_gpio_platform_data *pdata;
1095 struct resource *res; 1095 struct resource *res;
1096 struct gpio_bank *bank; 1096 struct gpio_bank *bank;
1097 int ret = 0;
1098 1097
1099 match = of_match_device(of_match_ptr(omap_gpio_match), dev); 1098 match = of_match_device(of_match_ptr(omap_gpio_match), dev);
1100 1099
@@ -1143,18 +1142,21 @@ static int omap_gpio_probe(struct platform_device *pdev)
1143 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1142 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1144 if (unlikely(!res)) { 1143 if (unlikely(!res)) {
1145 dev_err(dev, "Invalid mem resource\n"); 1144 dev_err(dev, "Invalid mem resource\n");
1145 irq_domain_remove(bank->domain);
1146 return -ENODEV; 1146 return -ENODEV;
1147 } 1147 }
1148 1148
1149 if (!devm_request_mem_region(dev, res->start, resource_size(res), 1149 if (!devm_request_mem_region(dev, res->start, resource_size(res),
1150 pdev->name)) { 1150 pdev->name)) {
1151 dev_err(dev, "Region already claimed\n"); 1151 dev_err(dev, "Region already claimed\n");
1152 irq_domain_remove(bank->domain);
1152 return -EBUSY; 1153 return -EBUSY;
1153 } 1154 }
1154 1155
1155 bank->base = devm_ioremap(dev, res->start, resource_size(res)); 1156 bank->base = devm_ioremap(dev, res->start, resource_size(res));
1156 if (!bank->base) { 1157 if (!bank->base) {
1157 dev_err(dev, "Could not ioremap\n"); 1158 dev_err(dev, "Could not ioremap\n");
1159 irq_domain_remove(bank->domain);
1158 return -ENOMEM; 1160 return -ENOMEM;
1159 } 1161 }
1160 1162
@@ -1178,7 +1180,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
1178 1180
1179 list_add_tail(&bank->node, &omap_gpio_list); 1181 list_add_tail(&bank->node, &omap_gpio_list);
1180 1182
1181 return ret; 1183 return 0;
1182} 1184}
1183 1185
1184#ifdef CONFIG_ARCH_OMAP2PLUS 1186#ifdef CONFIG_ARCH_OMAP2PLUS