Commit 709cb2f9 authored by Zhang Changzhong's avatar Zhang Changzhong Committed by Marc Kleine-Budde

can: etas_es58x: es58x_init_netdev(): free netdev when register_candev()

In case of register_candev() fails, clear
es58x_dev->netdev[channel_idx] and add free_candev(). Otherwise
es58x_free_netdevs() will unregister the netdev that has never been
registered.

Fixes: 85372578 ("can: etas_es58x: add core support for ETAS ES58X CAN USB interfaces")
Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
Acked-by: default avatarArunachalam Santhanam <Arunachalam.Santhanam@in.bosch.com>
Acked-by: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/1668413685-23354-1-git-send-email-zhangchangzhong@huawei.comSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 62ec89e7
...@@ -2091,8 +2091,11 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx) ...@@ -2091,8 +2091,11 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx)
netdev->dev_port = channel_idx; netdev->dev_port = channel_idx;
ret = register_candev(netdev); ret = register_candev(netdev);
if (ret) if (ret) {
es58x_dev->netdev[channel_idx] = NULL;
free_candev(netdev);
return ret; return ret;
}
netdev_queue_set_dql_min_limit(netdev_get_tx_queue(netdev, 0), netdev_queue_set_dql_min_limit(netdev_get_tx_queue(netdev, 0),
es58x_dev->param->dql_min_limit); es58x_dev->param->dql_min_limit);
......
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