2021-12-24 01:47:43

by Jiasheng Jiang

[permalink] [raw]
Subject: [PATCH v3] net: ks8851: Check for error irq

For the possible error irq number returned by the platform_get_irq(),
and it will finally cause the failure of the request_irq().
Consider that platform_get_irq() can now in certain cases return
-EPROBE_DEFER, and the consequences of letting request_irq() effectively
convert that into -EINVAL, even at probe time rather than later on.
So it might be better to check just now.

Fixes: 797047f875b5 ("net: ks8851: Implement Parallel bus operations")
Signed-off-by: Jiasheng Jiang <[email protected]>
---
Changelog:

v2 -> v3

*Change 1. Using error variable to check.
*Change 2. Refine commit message to be more reasonable.
---
drivers/net/ethernet/micrel/ks8851_par.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/micrel/ks8851_par.c b/drivers/net/ethernet/micrel/ks8851_par.c
index 2e8fcce50f9d..46e1651465a6 100644
--- a/drivers/net/ethernet/micrel/ks8851_par.c
+++ b/drivers/net/ethernet/micrel/ks8851_par.c
@@ -320,7 +320,10 @@ static int ks8851_probe_par(struct platform_device *pdev)
if (ret)
return ret;

- netdev->irq = platform_get_irq(pdev, 0);
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0)
+ return ret;
+ netdev->irq = ret;

return ks8851_probe_common(netdev, dev, msg_enable);
}
--
2.25.1