All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] drivers: net: smc911x: Check for error irq
@ 2021-12-24  1:40 Jiasheng Jiang
  0 siblings, 0 replies; only message in thread
From: Jiasheng Jiang @ 2021-12-24  1:40 UTC (permalink / raw)
  To: robin.murphy, andy.shevchenko, davem, kuba
  Cc: netdev, linux-kernel, Jiasheng Jiang

As platform_get_irq() could fail and return error irq number.
And the error irq 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: ae150435b59e ("smsc: Move the SMC (SMSC) drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changlog:

v3 -> v4

*Change 1. Using error varaible to check.
*Change 2. Fix commit message.
*Change 3. Refine commit message.
---
 drivers/net/ethernet/smsc/smc911x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c
index 22cdbf12c823..9470d9c07fed 100644
--- a/drivers/net/ethernet/smsc/smc911x.c
+++ b/drivers/net/ethernet/smsc/smc911x.c
@@ -2069,7 +2069,12 @@ static int smc911x_drv_probe(struct platform_device *pdev)
 	SET_NETDEV_DEV(ndev, &pdev->dev);
 
 	ndev->dma = (unsigned char)-1;
-	ndev->irq = platform_get_irq(pdev, 0);
+
+	ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		goto release_both;
+	ndev->irq = ret;
+
 	lp = netdev_priv(ndev);
 	lp->netdev = ndev;
 #ifdef SMC_DYNAMIC_BUS_CONFIG
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-24  1:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-24  1:40 [PATCH v4] drivers: net: smc911x: Check for error irq Jiasheng Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.