Skip to contentSkip to conversation

spi_mpc83xx: test below 0 on unsigned irq in mpc83xx_spi_probe()

PATCH In review Roel Kluin 3 participants 5 messages Apr 23, 2008 – Apr 30, 2008

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 spi_mpc83xx: test below 0 on unsigned irq in mpc83xx_spi_probe()

mpc83xx_spi->irq is unsigned, so the test fails

---

drivers/spi/spi_mpc83xx.c +5 -5
index be15a62..033fd51 100644
@@ -454,12 +454,12 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
 		goto put_master;
 	}
 
-	mpc83xx_spi->irq = platform_get_irq(dev, 0);
-
-	if (mpc83xx_spi->irq < 0) {
-		ret = -ENXIO;
+	ret = platform_get_irq(dev, 0);
+	if (ret < 0)
 		goto unmap_io;
-	}
+
+	mpc83xx_spi->irq = ret;
+	ret = 0;
 
 	/* Register for SPI Interrupt */
 	ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq,
#1 lore raw
Quoted 3 lines · Roel Kluin

mpc83xx_spi->irq is unsigned, so the test fails

you should copy the linux-spi list on such patches.

- k

Quoted 24 lines

---

drivers/spi/spi_mpc83xx.c +5 -5
index be15a62..033fd51 100644
@@ -454,12 +454,12 @@ static int __init mpc83xx_spi_probe(struct  
 platform_device *dev)
 		goto put_master;
 	}
 
-	mpc83xx_spi->irq = platform_get_irq(dev, 0);
-
-	if (mpc83xx_spi->irq < 0) {
-		ret = -ENXIO;
+	ret = platform_get_irq(dev, 0);
+	if (ret < 0)
 		goto unmap_io;
-	}
+
+	mpc83xx_spi->irq = ret;
+	ret = 0;
 
 	/* Register for SPI Interrupt */
Quoted 1 line
	ret = request_irq(mpc83xx_spi->irq, mpc83xx_spi_irq,

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

#2 lore raw
Quoted 5 lines · Kumar Gala
Quoted 3 lines · Roel Kluin

mpc83xx_spi->irq is unsigned, so the test fails

Any reason to not just make mpc83xx_spi->irq be "int", following normal practice everywhere? If not, I'll roll that into the patch from Joakim Tjernlund...

- Dave

author
#3 lore raw

PATCH 2/2 xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe()

In reply to Roel Kluin

similarly,
---
xilinx_spi->irq is unsigned, so the test fails

---

drivers/spi/xilinx_spi.c +5 -4
index cf6aef3..613db82 100644
@@ -353,11 +353,12 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
 		goto put_master;
 	}
 
-	xspi->irq = platform_get_irq(dev, 0);
-	if (xspi->irq < 0) {
-		ret = -ENXIO;
+	ret = platform_get_irq(dev, 0);
+	if (ret < 0)
 		goto unmap_io;
-	}
+
+	xspi->irq = ret;
+	ret = 0;
 
 	master->bus_num = pdata->bus_num;
 	master->num_chipselect = pdata->num_chipselect;

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

author
#4 lore raw

PATCH v2 2/2 xilinx_spi: test below 0 on unsigned irq in xilinx_spi_probe()

Quoted 29 lines · Joe Perches

Review

Quoted 10 lines · Roel Kluin
(quoted diff) +5 -4
-	xspi->irq = platform_get_irq(dev, 0);
-	if (xspi->irq < 0) {
-		ret = -ENXIO;
+	ret = platform_get_irq(dev, 0);
+	if (ret < 0)
 		goto unmap_io;
-	}
+
+	xspi->irq = ret;
+	ret = 0;

Is the only negative return from platform_get_irq ENXIO? I think you still need the ret = -ENXIO before the goto.

Also, you don't need the ret = 0 line, it's set again a few lines below.

I think you should end up with:

	ret = platform_get_irq(dev, 0);
	if (ret < 0) {
		ret = -ENXIO;
		goto unmap_io;
	}

	xspi->irq = ret;
Quoted 1 line

cheers, Joe

In that case, this should suffice,

thanks again,

Roel
---
xilinx_spi->irq is unsigned, so the test fails

---

drivers/spi/xilinx_spi.c +3 -2
index cf6aef3..2a471b3 100644
@@ -353,11 +353,12 @@ static int __init xilinx_spi_probe(struct platform_device *dev)
 		goto put_master;
 	}
 
-	xspi->irq = platform_get_irq(dev, 0);
-	if (xspi->irq < 0) {
+	ret = platform_get_irq(dev, 0);
+	if (ret < 0) {
 		ret = -ENXIO;
 		goto unmap_io;
 	}
+	xspi->irq = ret;
 
 	master->bus_num = pdata->bus_num;
 	master->num_chipselect = pdata->num_chipselect;

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone