[PATCH 10/10] net: ethernet: cpmac: Handle return value of platform_get_irq_byname

Arvind Yadav
2017-12-02T19:27:20Z

platform_get_irq_byname() can fail here and we must check its return
value

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/net/ethernet/ti/cpmac.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
index 9b8a30b..f3acfc0 100644
--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -1124,6 +1124,10 @@ static int cpmac_probe(struct platform_device *pdev)
}

dev->irq = platform_get_irq_byname(pdev, "irq");
+ if (dev->irq < 0) {
+ rc = dev->irq;
+ goto fail;
+ }

dev->netdev_ops = &cpmac_netdev_ops;
dev->ethtool_ops = &cpmac_ethtool_ops;
--
2.7.4