[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250930121609.158419-2-nm@ti.com>
Date: Tue, 30 Sep 2025 07:16:07 -0500
From: Nishanth Menon <nm@...com>
To: Uwe Kleine-König <u.kleine-koenig@...libre.com>,
Paolo
Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
Eric Dumazet
<edumazet@...gle.com>,
"David S. Miller" <davem@...emloft.net>,
Andrew Lunn
<andrew+netdev@...n.ch>
CC: Santosh Shilimkar <ssantosh@...nel.org>, Simon Horman <horms@...nel.org>,
Siddharth Vadapalli <s-vadapalli@...com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>, Nishanth Menon <nm@...com>
Subject: [PATCH V2 1/3] net: ethernet: ti: netcp: Handle both ERR_PTR and NULL from knav_dma_open_channel
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@...nel.org>
Signed-off-by: Nishanth Menon <nm@...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
Powered by blists - more mailing lists