Skip to content

Commit 5b6cb43

Browse files
ikhorndavem330
authored andcommitted
net: ethernet: ti: netcp_core: return error while dma channel open issue
Fix error path while dma open channel issue. Also, no need to check output on NULL if it's never returned. Signed-off-by: Ivan Khoronzhuk <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent dc319c4 commit 5b6cb43

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

drivers/net/ethernet/ti/netcp_core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,9 +1353,10 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
13531353

13541354
tx_pipe->dma_channel = knav_dma_open_channel(dev,
13551355
tx_pipe->dma_chan_name, &config);
1356-
if (IS_ERR_OR_NULL(tx_pipe->dma_channel)) {
1356+
if (IS_ERR(tx_pipe->dma_channel)) {
13571357
dev_err(dev, "failed opening tx chan(%s)\n",
13581358
tx_pipe->dma_chan_name);
1359+
ret = PTR_ERR(tx_pipe->dma_channel);
13591360
goto err;
13601361
}
13611362

@@ -1673,9 +1674,10 @@ static int netcp_setup_navigator_resources(struct net_device *ndev)
16731674

16741675
netcp->rx_channel = knav_dma_open_channel(netcp->netcp_device->device,
16751676
netcp->dma_chan_name, &config);
1676-
if (IS_ERR_OR_NULL(netcp->rx_channel)) {
1677+
if (IS_ERR(netcp->rx_channel)) {
16771678
dev_err(netcp->ndev_dev, "failed opening rx chan(%s\n",
16781679
netcp->dma_chan_name);
1680+
ret = PTR_ERR(netcp->rx_channel);
16791681
goto fail;
16801682
}
16811683

drivers/soc/ti/knav_dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ static int of_channel_match_helper(struct device_node *np, const char *name,
413413
* @name: slave channel name
414414
* @config: dma configuration parameters
415415
*
416-
* Returns pointer to appropriate DMA channel on success or NULL.
416+
* Returns pointer to appropriate DMA channel on success or error.
417417
*/
418418
void *knav_dma_open_channel(struct device *dev, const char *name,
419419
struct knav_dma_cfg *config)

0 commit comments

Comments
 (0)