Commit 4526fe74 authored by Daniele Palmas's avatar Daniele Palmas Committed by David S. Miller

drivers: net: mhi: fix error path in mhi_net_newlink

Fix double free_netdev when mhi_prepare_for_transfer fails.

Fixes: 3ffec6a1 ("net: Add mhi-net driver")
Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
Reviewed-by: default avatarManivannan Sadhasivam <mani@kernel.org>
Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5ab8a447
......@@ -321,7 +321,7 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
/* Start MHI channels */
err = mhi_prepare_for_transfer(mhi_dev);
if (err)
goto out_err;
return err;
/* Number of transfer descriptors determines size of the queue */
mhi_netdev->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
......@@ -331,10 +331,6 @@ static int mhi_net_newlink(struct mhi_device *mhi_dev, struct net_device *ndev)
return err;
return 0;
out_err:
free_netdev(ndev);
return err;
}
static void mhi_net_dellink(struct mhi_device *mhi_dev, struct net_device *ndev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment