From: Alex Elder <elder@ieee.org>
To: Kang Minchul <tegongkang@gmail.com>,
Alex Elder <elder@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3] net: ipa: Remove redundant comparison with zero
Date: Fri, 16 Dec 2022 15:34:23 -0600 [thread overview]
Message-ID: <941d8fa9-9c7b-8e06-e87a-b1c9ed80a639@ieee.org> (raw)
In-Reply-To: <20221216211124.154459-1-tegongkang@gmail.com>
On 12/16/22 3:11 PM, Kang Minchul wrote:
> platform_get_irq_byname() returns non-zero IRQ number on success,
> and negative error number on failure.
>
> So comparing return value with zero is unnecessary.
>
> Signed-off-by: Kang Minchul <tegongkang@gmail.com>
> ---
> drivers/net/ipa/gsi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c
> index bea2da1c4c51..e05e94bd9ba0 100644
> --- a/drivers/net/ipa/gsi.c
> +++ b/drivers/net/ipa/gsi.c
> @@ -1302,7 +1302,7 @@ static int gsi_irq_init(struct gsi *gsi, struct platform_device *pdev)
> int ret;
>
> ret = platform_get_irq_byname(pdev, "gsi");
> - if (ret <= 0)
> + if (ret < 0)
> return ret ? : -EINVAL;
In doing this, you assume platform_get_irq_byname() never
returns 0. I accept that assumption now. But in that case,
ret will *always* be non-zero if the branch is taken, so the
next line should simply be:
return ret;
There are two other places in the IPA driver that follow exactly
the same pattern of getting the IRQ number and handling the
possibility that the value returned is (erroneously) 0. If
you're making this change in one place, please do so in all
of them.
Frankly though, I think this change adds little value, and I
would be content to just leave everything as-is...
-Alex
>
> gsi->irq = ret;
next prev parent reply other threads:[~2022-12-16 21:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 21:11 Kang Minchul
2022-12-16 21:34 ` Alex Elder [this message]
2022-12-16 21:39 ` Kang Minchul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=941d8fa9-9c7b-8e06-e87a-b1c9ed80a639@ieee.org \
--to=elder@ieee.org \
--cc=davem@davemloft.net \
--cc=elder@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tegongkang@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®