From: Nishanth Menon <nm@ti.com>
To: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
"Andrew Lunn" <andrew+netdev@lunn.ch>
Cc: Santosh Shilimkar <ssantosh@kernel.org>,
Simon Horman <horms@kernel.org>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
Nishanth Menon <nm@ti.com>
Subject: [PATCH V2 1/3] net: ethernet: ti: netcp: Handle both ERR_PTR and NULL from knav_dma_open_channel
Date: Tue, 30 Sep 2025 07:16:07 -0500 [thread overview]
Message-ID: <20250930121609.158419-2-nm@ti.com> (raw)
In-Reply-To: <20250930121609.158419-1-nm@ti.com>
The knav_dma_open_channel function has inconsistent return behavior: the
header returns NULL when the driver is disabled, while the driver
implementation returns ERR_PTR(-EINVAL). This inconsistency creates
confusion for callers.
Prepare for standardizing the function to return NULL by updating callers
to handle both ERR_PTR and NULL return values using IS_ERR_OR_NULL()
checks.
Suggested-by: Simon Horman <horms@kernel.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
Changes in V2:
* renewed version
drivers/net/ethernet/ti/netcp_core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 857820657bac..2f9d26c791e3 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -1338,10 +1338,10 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
tx_pipe->dma_channel = knav_dma_open_channel(dev,
tx_pipe->dma_chan_name, &config);
- if (IS_ERR(tx_pipe->dma_channel)) {
+ if (IS_ERR_OR_NULL(tx_pipe->dma_channel)) {
dev_err(dev, "failed opening tx chan(%s)\n",
tx_pipe->dma_chan_name);
- ret = PTR_ERR(tx_pipe->dma_channel);
+ ret = -EINVAL;
goto err;
}
@@ -1678,10 +1678,10 @@ static int netcp_setup_navigator_resources(struct net_device *ndev)
netcp->rx_channel = knav_dma_open_channel(netcp->netcp_device->device,
netcp->dma_chan_name, &config);
- if (IS_ERR(netcp->rx_channel)) {
+ if (IS_ERR_OR_NULL(netcp->rx_channel)) {
dev_err(netcp->ndev_dev, "failed opening rx chan(%s\n",
netcp->dma_chan_name);
- ret = PTR_ERR(netcp->rx_channel);
+ ret = -EINVAL;
goto fail;
}
--
2.47.0
next prev parent reply other threads:[~2025-09-30 12:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-30 12:16 [PATCH V2 0/3] soc: ti: Fix crash in error path when DMA channel open fails Nishanth Menon
2025-09-30 12:16 ` Nishanth Menon [this message]
2025-09-30 12:16 ` [PATCH V2 2/3] soc: ti: knav_dma: Make knav_dma_open_channel return NULL on error Nishanth Menon
2025-09-30 23:59 ` Jacob Keller
2025-10-01 10:57 ` Nishanth Menon
2025-09-30 12:16 ` [PATCH V2 3/3] net: ethernet: ti: Remove IS_ERR_OR_NULL checks for knav_dma_open_channel Nishanth Menon
2025-09-30 23:59 ` Jacob Keller
2025-10-01 10:54 ` Nishanth Menon
2025-10-01 15:58 ` Simon Horman
2025-10-01 16:58 ` Nishanth Menon
2025-10-01 21:53 ` Jacob Keller
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=20250930121609.158419-2-nm@ti.com \
--to=nm@ti.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=s-vadapalli@ti.com \
--cc=ssantosh@kernel.org \
--cc=u.kleine-koenig@baylibre.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