Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752317AbdLBUHB (ORCPT ); Sat, 2 Dec 2017 15:07:01 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:39248 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752127AbdLBUG7 (ORCPT ); Sat, 2 Dec 2017 15:06:59 -0500 X-Google-Smtp-Source: AGs4zMao5raJG3v2umRgMnClBWOewAUFB0iIhb1eqVvFT37PoEV7eEXWIcxnquU4waRmylljnkHeVw== Subject: Re: [PATCH 07/10] net: ethernet: smsc: Handle return value of platform_get_irq To: Arvind Yadav , 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 References: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> <1512242782-7134-8-git-send-email-arvind.yadav.cs@gmail.com> From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <94e0d184-2d35-b6f0-687a-8df8ae67e37a@cogentembedded.com> Date: Sat, 2 Dec 2017 23:06:56 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1512242782-7134-8-git-send-email-arvind.yadav.cs@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 895 Lines: 30 On 12/02/2017 10:26 PM, Arvind Yadav wrote: > 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; Same comments as the next patch... > + goto release_both; > + } > + > lp = netdev_priv(ndev); > lp->netdev = ndev; > #ifdef SMC_DYNAMIC_BUS_CONFIG MBR, Sergei