Skip to contentSkip to conversation

asic3: platform_get_irq() may return signed unnoticed

PATCH New Roel Kluin 2 participants 4 messages Apr 23, 2008 Multifunction devices (MFD)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 asic3: platform_get_irq() may return signed unnoticed

asic->irq_nr is unsigned. platform_get_irq() may return signed unnoticed

---

drivers/mfd/asic3.c +1 -1
index f6f2d96..95f7b0c 100644
@@ -302,7 +302,7 @@ static int asic3_irq_probe(struct platform_device *pdev)
 	unsigned int irq, irq_base;
 
 	asic->irq_nr = platform_get_irq(pdev, 0);
-	if (asic->irq_nr < 0)
+	if (asic->irq_nr == -ENXIO)
 		return asic->irq_nr;
 
 	/* turn on clock to IRQ controller */
author
#1 lore raw

PATCH v2 1/1 asic3: platform_get_irq() may return signed unnoticed

asic->irq_nr is unsigned. platform_get_irq() may return signed unnoticed

---

drivers/mfd/asic3.c +5 -2
index f6f2d96..8068c06 100644
@@ -300,10 +300,13 @@ static int asic3_irq_probe(struct platform_device *pdev)
 	struct asic3 *asic = platform_get_drvdata(pdev);
 	unsigned long clksel = 0;
 	unsigned int irq, irq_base;
+	int ret;
 
-	asic->irq_nr = platform_get_irq(pdev, 0);
-	if (asic->irq_nr < 0)
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
 		return asic->irq_nr;
+	else
+		asic->irq_nr = ret;
 
 	/* turn on clock to IRQ controller */
 	clksel |= CLOCK_SEL_CX;
author
#2 lore raw

Thanks to Joe Perches for catching an error in my previous
---
asic->irq_nr is unsigned. platform_get_irq() may return signed unnoticed

---

drivers/mfd/asic3.c +6 -3
index f6f2d96..abd7ffc 100644
@@ -300,10 +300,13 @@ static int asic3_irq_probe(struct platform_device *pdev)
 	struct asic3 *asic = platform_get_drvdata(pdev);
 	unsigned long clksel = 0;
 	unsigned int irq, irq_base;
+	int ret;
+
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
 
-	asic->irq_nr = platform_get_irq(pdev, 0);
-	if (asic->irq_nr < 0)
-		return asic->irq_nr;
+	asic->irq_nr = ret;
 
 	/* turn on clock to IRQ controller */
 	clksel |= CLOCK_SEL_CX;
Acked-by
#3 lore raw
Quoted 1 line · Roel Kluin

Thanks to Joe Perches for catching an error in my previous

Yep, that makes sense now.

Quoted 4 lines

---
asic->irq_nr is unsigned. platform_get_irq() may return signed unnoticed

Quoted 23 lines

---

drivers/mfd/asic3.c +6 -3
index f6f2d96..abd7ffc 100644
@@ -300,10 +300,13 @@ static int asic3_irq_probe(struct platform_device *pdev)
 	struct asic3 *asic = platform_get_drvdata(pdev);
 	unsigned long clksel = 0;
 	unsigned int irq, irq_base;
+	int ret;
+
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
 
-	asic->irq_nr = platform_get_irq(pdev, 0);
-	if (asic->irq_nr < 0)
-		return asic->irq_nr;
+	asic->irq_nr = ret;
 
 	/* turn on clock to IRQ controller */
 	clksel |= CLOCK_SEL_CX;