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

Signed-off-by: Arvind Yadav <arvind.yadav...@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

Reply via email to