Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752690AbdLBT3A (ORCPT ); Sat, 2 Dec 2017 14:29:00 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:40963 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbdLBT0n (ORCPT ); Sat, 2 Dec 2017 14:26:43 -0500 X-Google-Smtp-Source: AGs4zMYYARtNNgX0Z2I15sFO4RJ/b0HUaymnGn8tKmYEjbjswk687JsjZ/SnoDmrxwLgRPx519lTmg== 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 Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: [PATCH 03/10] net: ezchip: nps_enet: Fix platform_get_irq's error checking Date: Sun, 3 Dec 2017 00:56:15 +0530 Message-Id: <1512242782-7134-4-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> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1155 Lines: 37 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. And remove unnecessary check for free_netdev(). Signed-off-by: Arvind Yadav --- drivers/net/ethernet/ezchip/nps_enet.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c index 659f1ad..82dc6d0 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; } @@ -646,8 +646,7 @@ static s32 nps_enet_probe(struct platform_device *pdev) out_netif_api: netif_napi_del(&priv->napi); out_netdev: - if (err) - free_netdev(ndev); + free_netdev(ndev); return err; } -- 2.7.4