Commit 4d1be581 authored by Zhang Qilong's avatar Zhang Qilong Committed by Jakub Kicinski

can: softing: softing_netdev_open(): fix error handling

If softing_netdev_open() fails, we should call close_candev() to avoid
reference leak.

Fixes: 03fd3cf5 ("can: add driver for Softing card")
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Acked-by: default avatarKurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
Link: https://lore.kernel.org/r/20201202151632.1343786-1-zhangqilong3@huawei.comSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Link: https://lore.kernel.org/r/20201204133508.742120-2-mkl@pengutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a54ba346
......@@ -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;
}
......
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