Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752962AbdLDQpF (ORCPT ); Mon, 4 Dec 2017 11:45:05 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:42484 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752865AbdLDQo6 (ORCPT ); Mon, 4 Dec 2017 11:44:58 -0500 X-Google-Smtp-Source: AGs4zMbYZbKzDsRtSEQLsxVcKGPDq5p0KJESNTrdTxJFugHaKrKpweQqRcv4yg5lmt5sCd7DVzOwVA== Subject: Re: [PATCH 03/10] net: ezchip: nps_enet: Fix platform_get_irq's error checking To: Russell King - ARM Linux , David Miller References: <1512242782-7134-4-git-send-email-arvind.yadav.cs@gmail.com> <20171204.112049.2189145622743900344.davem@davemloft.net> <20171204162447.GT10595@n2100.armlinux.org.uk> <20171204.113448.651799079717687661.davem@davemloft.net> <20171204164224.GU10595@n2100.armlinux.org.uk> Cc: f.fainelli@gmail.com, netdev@vger.kernel.org, michal.simek@xilinx.com, linux-kernel@vger.kernel.org, opendmb@gmail.com, mkl@pengutronix.de, linux-arm-kernel@lists.infradead.org, Vladislav.Zakharov@synopsys.com, wg@grandegger.com From: arvindY Message-ID: <5A257B83.7000803@gmail.com> Date: Mon, 4 Dec 2017 22:14:51 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20171204164224.GU10595@n2100.armlinux.org.uk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2511 Lines: 56 On Monday 04 December 2017 10:12 PM, Russell King - ARM Linux wrote: > On Mon, Dec 04, 2017 at 11:34:48AM -0500, David Miller wrote: >> From: Russell King - ARM Linux >> Date: Mon, 4 Dec 2017 16:24:47 +0000 >> >>> On Mon, Dec 04, 2017 at 11:20:49AM -0500, David Miller wrote: >>>> 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. >>> The issue of whether IRQ 0 is valid or not has been covered several times >>> by Linus, and the result is that it is deemed by Linus that IRQ 0 is not >>> a valid interrupt. >> Then either platform_get_irq() as defined or this commit message (or both) >> are wrong. > Indeed, the commit message is wrong, and that's already been pointed out > in previous patch sets. > I will change commit message. Commit message will be " The platform_get_irq() function returns negative if an error occurs, Zero if No irq found and positive number on get irq successful. platform_get_irq() error checking for only zero is not correct."