diff mbox

[1/5] gpio/omap: free irq domain in probe() failure paths

Message ID 1365106576-31816-2-git-send-email-jon-hunter@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hunter, Jon April 4, 2013, 8:16 p.m. UTC
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>
---
 drivers/gpio/gpio-omap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Linus Walleij April 10, 2013, 7:33 p.m. UTC | #1
On Thu, Apr 4, 2013 at 10:16 PM, Jon Hunter <jon-hunter@ti.com> wrote:

> 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>

Hm Kevin is still listed as maintainer on this driver but on a mail
address that bounces, can you send a patch replacing him in MAINTAINERS
with yourself if you're willing to pick it up?

Anyway, patch applied.

Yours,
Linus Walleij
Hunter, Jon April 10, 2013, 7:48 p.m. UTC | #2
On 04/10/2013 02:33 PM, Linus Walleij wrote:
> On Thu, Apr 4, 2013 at 10:16 PM, Jon Hunter <jon-hunter@ti.com> wrote:
> 
>> 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>
> 
> Hm Kevin is still listed as maintainer on this driver but on a mail
> address that bounces, can you send a patch replacing him in MAINTAINERS
> with yourself if you're willing to pick it up?
> 
> Anyway, patch applied.

Thanks. There is a patch to fix this queued for v3.10 [1].

Cheers
Jon

[1]
http://git.kernel.org/cgit/linux/kernel/git/arm/arm-soc.git/commit/MAINTAINERS?h=for-next&id=c69d72aec52eb5234f433259ac5dcc3b68f1480d
diff mbox

Patch

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 0d30c7a..1e666c8 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)
 	const struct omap_gpio_platform_data *pdata;
 	struct resource *res;
 	struct gpio_bank *bank;
-	int ret = 0;
 
 	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);
 	if (unlikely(!res)) {
 		dev_err(dev, "Invalid mem resource\n");
+		irq_domain_remove(bank->domain);
 		return -ENODEV;
 	}
 
 	if (!devm_request_mem_region(dev, res->start, resource_size(res),
 				     pdev->name)) {
 		dev_err(dev, "Region already claimed\n");
+		irq_domain_remove(bank->domain);
 		return -EBUSY;
 	}
 
 	bank->base = devm_ioremap(dev, res->start, resource_size(res));
 	if (!bank->base) {
 		dev_err(dev, "Could not ioremap\n");
+		irq_domain_remove(bank->domain);
 		return -ENOMEM;
 	}
 
@@ -1178,7 +1180,7 @@  static int omap_gpio_probe(struct platform_device *pdev)
 
 	list_add_tail(&bank->node, &omap_gpio_list);
 
-	return ret;
+	return 0;
 }
 
 #ifdef CONFIG_ARCH_OMAP2PLUS