can: softing: softing_netdev_open(): fix error handling
If softing_netdev_open() fails, we should call close_candev() to avoid
reference leak.
Fixes: 03fd3cf5a1
("can: add driver for Softing card")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Acked-by: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Link: https://lore.kernel.org/r/20201202151632.1343786-1-zhangqilong3@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20201204133508.742120-2-mkl@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a54ba3465d
commit
4d1be581ec
|
@ -382,8 +382,13 @@ static int softing_netdev_open(struct net_device *ndev)
|
|||
|
||||
/* check or determine and set bittime */
|
||||
ret = open_candev(ndev);
|
||||
if (!ret)
|
||||
ret = softing_startstop(ndev, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = softing_startstop(ndev, 1);
|
||||
if (ret < 0)
|
||||
close_candev(ndev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue