Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752588AbdLDRsz (ORCPT ); Mon, 4 Dec 2017 12:48:55 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:38027 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbdLDRss (ORCPT ); Mon, 4 Dec 2017 12:48:48 -0500 X-Google-Smtp-Source: AGs4zMbGIVc/UO6peVzmq586RdLKeaRvjSfZTLZdoNlXFGTEXFvIzDm1/RsEI453uWr93jEAlVrYRw== 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 2/7 v2] net: ezchip: nps_enet: Fix platform_get_irq's error checking Date: Mon, 4 Dec 2017 23:18:18 +0530 Message-Id: <1512409703-20881-3-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: 1000 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/ezchip/nps_enet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c index 659f1ad..7d4b628 100644 --- a/drivers/net/ethernet/ezchip/nps_enet.c +++ b/drivers/net/ethernet/ezchip/nps_enet.c @@ -623,9 +623,9 @@ static s32 nps_enet_probe(struct platform_device *pdev) /* Get IRQ number */ priv->irq = platform_get_irq(pdev, 0); - if (!priv->irq) { + if (priv->irq <= 0) { dev_err(dev, "failed to retrieve value from device tree\n"); - err = -ENODEV; + err = priv->irq ? priv->irq : -ENODEV; goto out_netdev; } -- 2.7.4