Skip to contentSkip to conversation

fixes warning

PATCH Superseded [email protected] 3 participants 5 messages Aug 4, 2023 SPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fixes warning

From: Rajeshwar R Shinde <[email protected]>

drivers/spi/spi-mpc512x-psc.c:493:5-13:
WARNING: Unsigned expression compared with zero: mps -> irq < 0

---
 drivers/spi/spi-mpc512x-psc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-mpc512x-psc.c +1 -1
index 99aeef2..50a4f31 100644
@@ -490,7 +490,7 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *pdev)
 		(struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc));
 
 	mps->irq = platform_get_irq(pdev, 0);
-	if (mps->irq < 0)
+	if ((int)mps->irq < 0)
 		return mps->irq;
 
 	ret = devm_request_irq(dev, mps->irq, mpc512x_psc_spi_isr, IRQF_SHARED,
Signature · 6 lines
2.25.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#1 lore raw

PATCH 2/2 fixes warning

From: Rajeshwar R Shinde <[email protected]>

drivers/spi/spi-mpc52xx-psc.c:332:5-13:
WARNING: Unsigned expression compared with zero: mps -> irq < 0

---
 drivers/spi/spi-mpc52xx-psc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-mpc52xx-psc.c +1 -1
index 9a1a080..7452bc9 100644
@@ -329,7 +329,7 @@ static int mpc52xx_psc_spi_of_probe(struct platform_device *pdev)
 	mps->fifo = ((void __iomem *)mps->psc) + sizeof(struct mpc52xx_psc);
 
 	mps->irq = platform_get_irq(pdev, 0);
-	if (mps->irq < 0)
+	if ((int)mps->irq < 0)
 		return mps->irq;
 
 	ret = devm_request_irq(dev, mps->irq, mpc52xx_psc_spi_isr, 0,
Signature · 1 line
2.25.1
maintainer
#3 lore raw
In reply to [email protected]
Quoted 4 lines · On Fri, Aug 04, 2023 at 05:21:21PM +0530, [email protected] wrote:

From: Rajeshwar R Shinde <[email protected]>

drivers/spi/spi-mpc52xx-psc.c:332:5-13:
WARNING: Unsigned expression compared with zero: mps -> irq < 0

Same issues here.

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

maintainer
#4 lore raw
In reply to [email protected]
Quoted 4 lines · On Fri, Aug 04, 2023 at 05:21:20PM +0530, [email protected] wrote:

From: Rajeshwar R Shinde <[email protected]>

drivers/spi/spi-mpc512x-psc.c:493:5-13:
WARNING: Unsigned expression compared with zero: mps -> irq < 0

Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.

drivers/spi/spi-mpc512x-psc.c static int mpc512x_psc_spi_of_probe(struct platform_device *pdev) · line 494

Quoted 4 lines
drivers/spi/spi-mpc512x-psc.c +1 -1
 	mps->irq = platform_get_irq(pdev, 0);
-	if (mps->irq < 0)
+	if ((int)mps->irq < 0)
 		return mps->irq;

Casts are almost always the wrong choice. If the issue is that the value is unsigned and can't be negative casting it to signed isn't going to help, though here possibly the type of the variable is wrong.