From: esben@geanix.com
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Michal Simek <michal.simek@amd.com>,
Harini Katakam <harini.katakam@amd.com>,
Haoyue Xu <xuhaoyue1@hisilicon.com>,
huangjunxian <huangjunxian6@hisilicon.com>,
Yang Yingliang <yangyingliang@huawei.com>,
Rob Herring <robh@kernel.org>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH net] net: ll_temac: fix error checking of irq_of_parse_and_map()
Date: Mon, 31 Jul 2023 10:02:00 +0200 [thread overview]
Message-ID: <87jzug4ih3.fsf@geanix.com> (raw)
In-Reply-To: <3d0aef75-06e0-45a5-a2a6-2cc4738d4143@moroto.mountain> (Dan Carpenter's message of "Mon, 31 Jul 2023 10:42:32 +0300")
Dan Carpenter <dan.carpenter@linaro.org> writes:
> Most kernel functions return negative error codes but some irq functions
> return zero on error. In this code irq_of_parse_and_map(), returns zero
> and platform_get_irq() returns negative error codes. We need to handle
> both cases appropriately.
>
> Fixes: 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Esben Haabendal <esben@geanix.com>
> ---
> drivers/net/ethernet/xilinx/ll_temac_main.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index e0ac1bcd9925..49f303353ecb 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1567,12 +1567,16 @@ static int temac_probe(struct platform_device *pdev)
> }
>
> /* Error handle returned DMA RX and TX interrupts */
> - if (lp->rx_irq < 0)
> - return dev_err_probe(&pdev->dev, lp->rx_irq,
> + if (lp->rx_irq <= 0) {
> + rc = lp->rx_irq ?: -EINVAL;
> + return dev_err_probe(&pdev->dev, rc,
> "could not get DMA RX irq\n");
> - if (lp->tx_irq < 0)
> - return dev_err_probe(&pdev->dev, lp->tx_irq,
> + }
> + if (lp->tx_irq <= 0) {
> + rc = lp->tx_irq ?: -EINVAL;
> + return dev_err_probe(&pdev->dev, rc,
> "could not get DMA TX irq\n");
> + }
>
> if (temac_np) {
> /* Retrieve the MAC address */
next prev parent reply other threads:[~2023-07-31 8:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 7:42 [PATCH net] net: ll_temac: fix error checking of irq_of_parse_and_map() Dan Carpenter
2023-07-31 8:02 ` esben [this message]
2023-07-31 8:02 ` Yang Yingliang
2023-07-31 10:57 ` Katakam, Harini
2023-08-01 21:50 ` 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=87jzug4ih3.fsf@geanix.com \
--to=esben@geanix.com \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=harini.katakam@amd.com \
--cc=huangjunxian6@hisilicon.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=xuhaoyue1@hisilicon.com \
--cc=yangyingliang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).