Skip to contentSkip to conversation

peci: Fix platform_get_irq() error checking

PATCH In review Dan Carpenter 2 participants 2 messages Aug 11, 2022 – Aug 15, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 peci: Fix platform_get_irq() error checking

The platform_get_irq() function returns success or negative error codes on failure.

Fixes a85e4c52086c ("peci: Add peci-aspeed controller driver")
---
 drivers/peci/controller/peci-aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/peci/controller/peci-aspeed.c +1 -1
index 1925ddc13f00..731c5d8f75c6 100644
@@ -523,7 +523,7 @@ static int aspeed_peci_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->base);
 
 	priv->irq = platform_get_irq(pdev, 0);
-	if (!priv->irq)
+	if (priv->irq < 0)
 		return priv->irq;
 
 	ret = devm_request_irq(&pdev->dev, priv->irq, aspeed_peci_irq_handler,
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 2 lines · Dan Carpenter

The platform_get_irq() function returns success or negative error codes on failure.

Hi,

The patch that fixes this problem was already picked up:
https://git.kernel.org/pub/scm/linux/kernel/git/iwi/linux.git/commit/?h=peci-next&id=e79b548b7202bb3accdfe64f113129a4340bc2f9

Thanks
-Iwona

Quoted 21 lines
Fixes a85e4c52086c ("peci: Add peci-aspeed controller driver")

---
?drivers/peci/controller/peci-aspeed.c | 2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)

drivers/peci/controller/peci-aspeed.c +0 -0
index 1925ddc13f00..731c5d8f75c6 100644
@@ -523,7 +523,7 @@ static int aspeed_peci_probe(struct platform_device *pdev)
 ????????????????return PTR_ERR(priv->base);

?
????????priv->irq = platform_get_irq(pdev, 0);
-???????if (!priv->irq)
+???????if (priv->irq < 0)
????????????????return priv->irq;
?
????????ret = devm_request_irq(&pdev->dev, priv->irq, aspeed_peci_irq_handler,