Skip to contentSkip to conversation

net: Fix checks on unsigned in w90p910_ether_probe()

PATCH In review Roel Kluin 3 participants 3 messages Oct 20, 2009 – Oct 30, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 net: Fix checks on unsigned in w90p910_ether_probe()

ether->txirq and ->rxirq are unsigned

---

drivers/net/arm/w90p910_ether.c +9 -7
index 25e2627..503c2ce 100644
@@ -981,7 +981,7 @@ static int __devinit w90p910_ether_probe(struct platform_device *pdev)
 {
 	struct w90p910_ether *ether;
 	struct net_device *dev;
-	int error;
+	int error, ret;
 
 	dev = alloc_etherdev(sizeof(struct w90p910_ether));
 	if (!dev)
@@ -1010,17 +1010,19 @@ static int __devinit w90p910_ether_probe(struct platform_device *pdev)
 		goto failed_free_mem;
 	}
 
-	ether->txirq = platform_get_irq(pdev, 0);
-	if (ether->txirq < 0) {
+	ret = platform_get_irq(pdev, 0);
+	ether->txirq = ret;
+	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to get ether tx irq\n");
-		error = -ENXIO;
+		error = ret;
 		goto failed_free_io;
 	}
 
-	ether->rxirq = platform_get_irq(pdev, 1);
-	if (ether->rxirq < 0) {
+	ret = platform_get_irq(pdev, 1);
+	ether->rxirq = ret;
+	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to get ether rx irq\n");
-		error = -ENXIO;
+		error = ret;
 		goto failed_free_txirq;
 	}
 
maintainer
#1 lore raw

From: Roel Kluin <[email protected]>
Date: Tue, 20 Oct 2009 20:14:36 +0200

Quoted 3 lines

ether->txirq and ->rxirq are unsigned

platform_get_irq() returns a signed int so the intention is more likely that catching negative value returns was intended.

Probably the correct fix is to mark txirq and rxirq as plain 'int'.

#2 lore raw

Dear sirs,

Okay, it is right, thanks all for your help.
I will re-fix it later.

2009/10/30, David Miller <[email protected]>:

Quoted 14 lines

From: Roel Kluin <[email protected]>
Date: Tue, 20 Oct 2009 20:14:36 +0200

Quoted 3 lines

ether->txirq and ->rxirq are unsigned

platform_get_irq() returns a signed int so the intention is more likely that catching negative value returns was intended.

Probably the correct fix is to mark txirq and rxirq as plain 'int'.

Signature · 1 line
Wan z.s