Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752422AbdLBUIw (ORCPT ); Sat, 2 Dec 2017 15:08:52 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:39355 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752075AbdLBUIu (ORCPT ); Sat, 2 Dec 2017 15:08:50 -0500 X-Google-Smtp-Source: AGs4zMathk1M7zO6W3nqHkzMPx76Z3NWAJGv32PTZqmSfyb/SPOsYzDnQtdLP46y9lUPV+JiF2SDkA== Subject: Re: [PATCH 05/10] net: ethernet: i825xx: Fix platform_get_irq's error checking 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-6-git-send-email-arvind.yadav.cs@gmail.com> From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <2b23637d-0d19-4a6a-4e67-e64968f85415@cogentembedded.com> Date: Sat, 2 Dec 2017 23:08:47 +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-6-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: 1108 Lines: 33 Hello. On 12/02/2017 10:26 PM, Arvind Yadav wrote: > The platform_get_irq() function returns negative if an error occurs. > zero or positive number on success. platform_get_irq() error checking > for zero is not correct. The why you consider returning 0 a sign of failure? > Signed-off-by: Arvind Yadav > --- > drivers/net/ethernet/i825xx/sni_82596.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/i825xx/sni_82596.c b/drivers/net/ethernet/i825xx/sni_82596.c > index b2c04a7..a6d56f5 100644 > --- a/drivers/net/ethernet/i825xx/sni_82596.c > +++ b/drivers/net/ethernet/i825xx/sni_82596.c > @@ -120,9 +120,10 @@ static int sni_82596_probe(struct platform_device *dev) > netdevice->dev_addr[5] = readb(eth_addr + 0x06); > iounmap(eth_addr); > > - if (!netdevice->irq) { > + if (netdevice->irq <= 0) { > printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n", > __FILE__, netdevice->base_addr); > + retval = netdevice->irq ? netdevice->irq : -ENODEV; > goto probe_failed; > } > MBR, Sergei