[PATCH 5.19 011/155] peci: aspeed: fix error check return value of platform_get_irq()

From: Greg Kroah-Hartman
Date: Tue Sep 06 2022 - 10:02:05 EST


From: Lv Ruyi <lv.ruyi@xxxxxxxxxx>

[ Upstream commit e79b548b7202bb3accdfe64f113129a4340bc2f9 ]

platform_get_irq() return negative value on failure, so null check of
priv->irq is incorrect. Fix it by comparing whether it is less than zero.

Fixes: a85e4c52086c ("peci: Add peci-aspeed controller driver")
Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Lv Ruyi <lv.ruyi@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20220413010425.2534887-1-lv.ruyi@xxxxxxxxxx
Reviewed-by: Iwona Winiarska <iwona.winiarska@xxxxxxxxx>
Signed-off-by: Iwona Winiarska <iwona.winiarska@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/peci/controller/peci-aspeed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/peci/controller/peci-aspeed.c b/drivers/peci/controller/peci-aspeed.c
index 1925ddc13f002..731c5d8f75c66 100644
--- a/drivers/peci/controller/peci-aspeed.c
+++ b/drivers/peci/controller/peci-aspeed.c
@@ -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,
--
2.35.1