diff mbox series

[next,v2,2/2] mmc: sunplus: Fix platform_get_irq() error checking

Message ID 20230809071812.547229-2-harshit.m.mogalapalli@oracle.com
State New
Headers show
Series [next,v2,1/2] mmc: sunplus: Fix error handling in spmmc_drv_probe() | expand

Commit Message

Harshit Mogalapalli Aug. 9, 2023, 7:18 a.m. UTC
The platform_get_irq() function returns negative error codes on failure.

Fixes: 4e268fed8b18 ("mmc: Add mmc driver for Sunplus SP7021")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/a3829ed3-d827-4b9d-827e-9cc24a3ec3bc@moroto.mountain/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
v1->v2: Split into two patches as they are doing different things.

This is based on static analysis with smatch, only compile tested.
---
 drivers/mmc/host/sunplus-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c
index 2bdebeb1f8e4..e9cb1a57cb75 100644
--- a/drivers/mmc/host/sunplus-mmc.c
+++ b/drivers/mmc/host/sunplus-mmc.c
@@ -885,7 +885,7 @@  static int spmmc_drv_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(host->rstc), "rst get fail\n");
 
 	host->irq = platform_get_irq(pdev, 0);
-	if (host->irq <= 0)
+	if (host->irq < 0)
 		return host->irq;
 
 	ret = devm_request_threaded_irq(&pdev->dev, host->irq,