Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753824AbdLDQUx (ORCPT ); Mon, 4 Dec 2017 11:20:53 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:49410 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615AbdLDQUv (ORCPT ); Mon, 4 Dec 2017 11:20:51 -0500 Date: Mon, 04 Dec 2017 11:20:49 -0500 (EST) Message-Id: <20171204.112049.2189145622743900344.davem@davemloft.net> To: arvind.yadav.cs@gmail.com Cc: wg@grandegger.com, mkl@pengutronix.de, michal.simek@xilinx.com, opendmb@gmail.com, f.fainelli@gmail.com, Vladislav.Zakharov@synopsys.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: Re: [PATCH 03/10] net: ezchip: nps_enet: Fix platform_get_irq's error checking From: David Miller In-Reply-To: <1512242782-7134-4-git-send-email-arvind.yadav.cs@gmail.com> References: <1512242782-7134-1-git-send-email-arvind.yadav.cs@gmail.com> <1512242782-7134-4-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 04 Dec 2017 08:20:50 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1428 Lines: 36 From: Arvind Yadav Date: Sun, 3 Dec 2017 00:56:15 +0530 > 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; If platform_get_irq() returns "zero or positive number on success" then this test is wrong and should be "if (priv->irq < 0)" Also, this series is a mix of different kinds of changes. Please separate out the platform IRQ error checking and just submit exactly those changes as a patch series. The other bug fixes should be submitted outside of those changes since they are unrelated.