Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812AbdLDRtj (ORCPT ); Mon, 4 Dec 2017 12:49:39 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38046 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbdLDRtA (ORCPT ); Mon, 4 Dec 2017 12:49:00 -0500 X-Google-Smtp-Source: AGs4zMZc9Gn8ec5J5uVcdlrDA9/ZQQyVc3uOioJPDp30b5kJIsSHvwWB6oH3SJZkbnrUziaWUiDf4g== From: Arvind Yadav To: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 6/7 v2] net: ethernet: smsc: Fix platform_get_irq's error checking Date: Mon, 4 Dec 2017 23:18:22 +0530 Message-Id: <1512409703-20881-7-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512409703-20881-1-git-send-email-arvind.yadav.cs@gmail.com> References: <1512409703-20881-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: 813 Lines: 28 platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- changes in v2: commit message was not correct. 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..5e3c7af 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