From: Jakub Kicinski <kuba@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Ruan Jinjie <ruanjinjie@huawei.com>, <yisen.zhuang@huawei.com>,
<salil.mehta@huawei.com>, <davem@davemloft.net>,
<edumazet@google.com>, <pabeni@redhat.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next] net: hisilicon: fix the return value handle and remove redundant netdev_err() for platform_get_irq()
Date: Tue, 1 Aug 2023 14:43:47 -0700 [thread overview]
Message-ID: <20230801144347.140cc06f@kernel.org> (raw)
In-Reply-To: <20230731073858.3633193-1-ruanjinjie@huawei.com>
On Mon, 31 Jul 2023 15:38:58 +0800 Ruan Jinjie wrote:
> There is no possible for platform_get_irq() to return 0
> and the return value of platform_get_irq() is more sensible
> to show the error reason.
>
> And there is no need to call the netdev_err() function directly to print
> a custom message when handling an error from platform_get_irq() function as
> it is going to display an appropriate error message in case of a failure.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Dan, with the sample of one patch from you I just applied I induce
that treating 0 as error and returning a -EINVAL in that case may
be preferable here?
> diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
> index 50c3f5d6611f..ecf92a5d56bb 100644
> --- a/drivers/net/ethernet/hisilicon/hip04_eth.c
> +++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
> @@ -960,8 +960,8 @@ static int hip04_mac_probe(struct platform_device *pdev)
> }
>
> irq = platform_get_irq(pdev, 0);
> - if (irq <= 0) {
> - ret = -EINVAL;
> + if (irq < 0) {
> + ret = irq;
> goto init_fail;
> }
>
> diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
> index ce2571c16e43..cb7b0293fe85 100644
> --- a/drivers/net/ethernet/hisilicon/hisi_femac.c
> +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
> @@ -862,8 +862,8 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
> goto out_disconnect_phy;
>
> ndev->irq = platform_get_irq(pdev, 0);
> - if (ndev->irq <= 0) {
> - ret = -ENODEV;
> + if (ndev->irq < 0) {
> + ret = ndev->irq;
> goto out_disconnect_phy;
> }
>
> diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> index f867e9531117..26d22bb04b87 100644
> --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> @@ -1206,9 +1206,8 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
> }
>
> ndev->irq = platform_get_irq(pdev, 0);
> - if (ndev->irq <= 0) {
> - netdev_err(ndev, "No irq resource\n");
> - ret = -EINVAL;
> + if (ndev->irq < 0) {
> + ret = ndev->irq;
> goto out_phy_node;
> }
>
next prev parent reply other threads:[~2023-08-01 21:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 7:38 [PATCH -next] net: hisilicon: fix the return value handle and remove redundant netdev_err() for platform_get_irq() Ruan Jinjie
2023-07-31 20:01 ` Jesse Brandeburg
2023-08-01 21:43 ` Jakub Kicinski [this message]
2023-08-02 6:00 ` Dan Carpenter
2023-08-02 19:10 ` patchwork-bot+netdevbpf
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=20230801144347.140cc06f@kernel.org \
--to=kuba@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ruanjinjie@huawei.com \
--cc=salil.mehta@huawei.com \
--cc=yisen.zhuang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.