2021-12-23 12:49:57

by Jiasheng Jiang

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

For the possible error irq number returned by the platform_get_irq(), it
should be better to check it in order to prevent the wrong use of error
irq number.

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

v1 -> v2

*Change 1. Using error variable to check.
---
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