Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565AbdLBT1D (ORCPT ); Sat, 2 Dec 2017 14:27:03 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:44333 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbdLBT05 (ORCPT ); Sat, 2 Dec 2017 14:26:57 -0500 X-Google-Smtp-Source: AGs4zMaQ1+b8rTMPLvySnf321YGBvVzqwQxdJt9yXcYSmGdNDLBLh7K+mTZFF5bBMsY/ICJ5q49v8A== From: Arvind Yadav To: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, Vladislav.Zakharov@synopsys.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 07/10] net: ethernet: smsc: Handle return value of platform_get_irq Date: Sun, 3 Dec 2017 00:56:19 +0530 Message-Id: <1512242782-7134-8-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 752 Lines: 25 platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/net/ethernet/smsc/smc911x.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/smsc/smc911x.c b/drivers/net/ethernet/smsc/smc911x.c index 0515744..a1cf18c 100644 --- a/drivers/net/ethernet/smsc/smc911x.c +++ b/drivers/net/ethernet/smsc/smc911x.c @@ -2088,6 +2088,11 @@ static int smc911x_drv_probe(struct platform_device *pdev) ndev->dma = (unsigned char)-1; ndev->irq = platform_get_irq(pdev, 0); + if (ndev->irq <= 0) { + ret = ndev->irq ? ndev->irq : -ENODEV; + goto release_both; + } + lp = netdev_priv(ndev); lp->netdev = ndev; #ifdef SMC_DYNAMIC_BUS_CONFIG -- 2.7.4