From patchwork Sat Dec 2 19:26:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10089005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0B80D60380 for ; Sat, 2 Dec 2017 19:29:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F14D02934A for ; Sat, 2 Dec 2017 19:29:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E60422935B; Sat, 2 Dec 2017 19:29:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D3922934A for ; Sat, 2 Dec 2017 19:29:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=TMGmHhpkwTedPCLUHutLP2LaQyAjE4Pve9AAyg2rtxg=; b=LzGRdUrIq9BofmZ+TuZaRp1pC4 U3g60v4U2Mn8jmqNA9R/2fPd6lH0MsbdPPMsEx1XjlTyCV4zfwfozu4cKugkmWI0yTmEI/6Otp57d P2jieiIjY2I3cs+urxeNdrtNy+ds07BT391f5fyH03Coku7Zl0C0Q0kvW/kf9+BDb1IYG/DiVSEDq nOUOxa0wjrzIjJ4kD9045bLRguwMBIQjd1YLSzaJbslFH7IDlrmEBEbqgCA7lIXcV6BTbx8ACQA/w MQQyk4JNxR9Wy8uaK9pzZLialcU2TY4oe66MCKRTa4HHk+XK0XvnMHVSlbm5Pxi2nLd6bhxzmVFP5 bDr0rQQA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLDTT-0002Jx-Dn; Sat, 02 Dec 2017 19:29:19 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLDRW-00006s-Bf for linux-arm-kernel@lists.infradead.org; Sat, 02 Dec 2017 19:27:22 +0000 Received: by mail-pf0-x241.google.com with SMTP id u25so6086796pfg.5 for ; Sat, 02 Dec 2017 11:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nRQlom2cn1YQyAodDUM0fj2/PoEM0RA/qcwNM4u1u6g=; b=Nl8IkjzSCb0CIGvm4tUkA2sK2PZZ1tqJ6IU7Pcxv/4k3EU+0COSje++/PEYQtiQdnJ HgsIBMM3W3O42kfEgosaua7i3xS8yxwT2l4J+qJSPiSGY/jbUIDY2QkIwYLzQmPz5fnZ M6NYw7uA3eHS8gQtk43bFyVdfkCrjm2EhLEXK84EEWq0B+FlEyjMPuBM/cQ4cPWldUMY ZIpkl+6o7mZHvVEwciuyOXYO3IhEFnUmzVJcMgpnAmRQU8HJItesntqi3gyHVgZ7mzRA GUsn/bkvH44Ps4E8J+Z2ratebez2zldTuzvpQuFzub5eutl9P35V8N1fJ78q3Z/A5MrE Gt+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=nRQlom2cn1YQyAodDUM0fj2/PoEM0RA/qcwNM4u1u6g=; b=d7wTt78Kn12bIFzaI6PnWbgwZX3RhlhdDIO0N4eUeos5oeIhvuqtI4tJK1CG9SHYkT pWoaIKkRjkH84a7ZXIYePmzzkZFUfmOT4LwDF8KdvgauGBLJFp0Y+vK2CURUoljTVFFu HEkuSfm7AjPvZiSZysPwe29jvtriNb1GwcWZUuFEuMKr4Y9pIdYo0G/bNkgbbof+eJNT RnrWDszlR1I/1PrXTZhm6QmiTMBZco9mfTRRwe1Cw2tjfB1HmeSuGHsnrnJY+86C3nN2 6ixo1e+t07Ah1YSY8U1y/spV6Z04rCjnIPAEtGdZSHZuK6cJaZlK3HHgJqMXUdElkCAn negg== X-Gm-Message-State: AJaThX48NyW6bZmpK0jX3hJWjbFXlQWn+yKhtBKgOrZAu3f+wl2K/9lj OoLzONa8QosGpDVH3ZrdRmI= X-Google-Smtp-Source: AGs4zMaQ1+b8rTMPLvySnf321YGBvVzqwQxdJt9yXcYSmGdNDLBLh7K+mTZFF5bBMsY/ICJ5q49v8A== X-Received: by 10.99.144.68 with SMTP id a65mr9951213pge.429.1512242817258; Sat, 02 Dec 2017 11:26:57 -0800 (PST) Received: from localhost.localdomain ([103.16.68.147]) by smtp.gmail.com with ESMTPSA id 140sm15167899pgd.85.2017.12.02.11.26.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Dec 2017 11:26:56 -0800 (PST) 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171202_112718_964568_BEF31062 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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