Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752864AbdLDRuQ (ORCPT ); Mon, 4 Dec 2017 12:50:16 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32808 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752474AbdLDRsy (ORCPT ); Mon, 4 Dec 2017 12:48:54 -0500 X-Google-Smtp-Source: AGs4zMafXgIWpbITTDUKmzrueE1KUIZo52MYvnMndwC+DPOLPsBWFU164TNwqp5qfto0osoovjStVg== 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 4/7 v2] net: ethernet: i825xx: Fix platform_get_irq's error checking Date: Mon, 4 Dec 2017 23:18:20 +0530 Message-Id: <1512409703-20881-5-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: 1042 Lines: 30 The platform_get_irq() function returns negative number if an error occurs, Zero if No irq is found and positive number if irq gets successful. platform_get_irq() error checking only for zero is not correct. Signed-off-by: Arvind Yadav --- changes in v2: commit message was not correct. 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..f2a11fc 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; } -- 2.7.4