Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jon Hunter and committed by
Linus Walleij
879fe324 2b78f1e1

+4 -2
+4 -2
drivers/gpio/gpio-omap.c
··· 1094 1094 const struct omap_gpio_platform_data *pdata; 1095 1095 struct resource *res; 1096 1096 struct gpio_bank *bank; 1097 - int ret = 0; 1098 1097 1099 1098 match = of_match_device(of_match_ptr(omap_gpio_match), dev); 1100 1099 ··· 1142 1143 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1143 1144 if (unlikely(!res)) { 1144 1145 dev_err(dev, "Invalid mem resource\n"); 1146 + irq_domain_remove(bank->domain); 1145 1147 return -ENODEV; 1146 1148 } 1147 1149 1148 1150 if (!devm_request_mem_region(dev, res->start, resource_size(res), 1149 1151 pdev->name)) { 1150 1152 dev_err(dev, "Region already claimed\n"); 1153 + irq_domain_remove(bank->domain); 1151 1154 return -EBUSY; 1152 1155 } 1153 1156 1154 1157 bank->base = devm_ioremap(dev, res->start, resource_size(res)); 1155 1158 if (!bank->base) { 1156 1159 dev_err(dev, "Could not ioremap\n"); 1160 + irq_domain_remove(bank->domain); 1157 1161 return -ENOMEM; 1158 1162 } 1159 1163 ··· 1180 1178 1181 1179 list_add_tail(&bank->node, &omap_gpio_list); 1182 1180 1183 - return ret; 1181 + return 0; 1184 1182 } 1185 1183 1186 1184 #ifdef CONFIG_ARCH_OMAP2PLUS