net: ethernet: ti: cpdma: correct error handling for chan create
It's not correct to return NULL when that is actually an error and function returns errors in any other wrong case. In the same time, the cpsw driver and davinci emac doesn't check error case while creating channel and it can miss actual error. Also remove WARNs replacing them on dev_err msgs. Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
f56ec6766d
commit
8a83c5d796
@@ -3065,10 +3065,16 @@ static int cpsw_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
cpsw->txv[0].ch = cpdma_chan_create(cpsw->dma, 0, cpsw_tx_handler, 0);
|
||||
if (IS_ERR(cpsw->txv[0].ch)) {
|
||||
dev_err(priv->dev, "error initializing tx dma channel\n");
|
||||
ret = PTR_ERR(cpsw->txv[0].ch);
|
||||
goto clean_dma_ret;
|
||||
}
|
||||
|
||||
cpsw->rxv[0].ch = cpdma_chan_create(cpsw->dma, 0, cpsw_rx_handler, 1);
|
||||
if (WARN_ON(!cpsw->rxv[0].ch || !cpsw->txv[0].ch)) {
|
||||
dev_err(priv->dev, "error initializing dma channels\n");
|
||||
ret = -ENOMEM;
|
||||
if (IS_ERR(cpsw->rxv[0].ch)) {
|
||||
dev_err(priv->dev, "error initializing rx dma channel\n");
|
||||
ret = PTR_ERR(cpsw->rxv[0].ch);
|
||||
goto clean_dma_ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user