Skip to contentSkip to conversation

drivers/gpio/*twl* need call irq_free_descs when leaving

PATCH In review Chen Gang 2 participants 3 messages Feb 16, 2013 – Feb 18, 2013 GPIO

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 drivers/gpio/*twl* need call irq_free_descs when leaving

since already call irq_alloc_descs before,
we need call irq_free_descs when quiting, or resource leak.

---
 drivers/gpio/gpio-twl4030.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/gpio/gpio-twl4030.c +4 -1
index 4d330e3..26aef72 100644
@@ -486,8 +486,10 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
 			      &irq_domain_simple_ops, NULL);
 
 	ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO, irq_base);
-	if (ret < 0)
+	if (ret < 0) {
+		irq_free_descs(irq_base, TWL4030_GPIO_MAX);
 		return ret;
+	}
 
 	priv->irq_base = irq_base;
 
@@ -578,6 +580,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev)
 
 	/* REVISIT no support yet for deregistering all the IRQs */
 	WARN_ON(1);
+	irq_free_descs(priv->irq_base, TWL4030_GPIO_MAX);
 	return -EIO;
 }
 
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 3 lines · Chen Gang

since already call irq_alloc_descs before,
we need call irq_free_descs when quiting, or resource leak.

While it is true that we need to free the descs, but this patch is not correct. We have other issues to fix in the driver - I have not looked at the probe/remove path yet, but the sequence is not right and also the call of gpio_twl4030_remove() from probe is not correct.

I'll send a small series to fix these up.

Quoted 31 lines
---
 drivers/gpio/gpio-twl4030.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/gpio/gpio-twl4030.c +4 -1
index 4d330e3..26aef72 100644
@@ -486,8 +486,10 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
 			      &irq_domain_simple_ops, NULL);
 
 	ret = twl4030_sih_setup(&pdev->dev, TWL4030_MODULE_GPIO, irq_base);
-	if (ret < 0)
+	if (ret < 0) {
+		irq_free_descs(irq_base, TWL4030_GPIO_MAX);
 		return ret;
+	}
 
 	priv->irq_base = irq_base;
 
@@ -578,6 +580,7 @@ static int gpio_twl4030_remove(struct platform_device *pdev)
 
 	/* REVISIT no support yet for deregistering all the IRQs */
 	WARN_ON(1);
+	irq_free_descs(priv->irq_base, TWL4030_GPIO_MAX);
 	return -EIO;
 }
 
Signature · 1 line
Péter
author
#2 lore raw
Quoted 11 lines · Peter Ujfalusi
Quoted 3 lines · Chen Gang
Quoted 3 lines

since already call irq_alloc_descs before,
we need call irq_free_descs when quiting, or resource leak.

While it is true that we need to free the descs, but this patch is not correct. We have other issues to fix in the driver - I have not looked at the probe/remove path yet, but the sequence is not right and also the call of gpio_twl4030_remove() from probe is not correct.

I'll send a small series to fix these up.

ok, thank you.

:-)

Signature · 3 lines
Chen Gang

Asianux Corporation