diff options
author | Zhang Qilong <zhangqilong3@huawei.com> | 2020-11-28 21:39:22 +0800 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-11-30 12:43:55 +0100 |
commit | 13a84cf37a4cf1155a41684236c2314eb40cd65c (patch) | |
tree | 7b172ebff23503bb8b5b009690d891325ecdf74f /drivers/net/can/kvaser_pciefd.c | |
parent | 44cef0c0ffbd8d61143712ce874be68a273b7884 (diff) |
can: kvaser_pciefd: kvaser_pciefd_open(): fix error handling
If kvaser_pciefd_bus_on() failed, we should call close_candev() to avoid
reference leak.
Fixes: 26ad340e582d3 ("can: kvaser_pciefd: Add driver for Kvaser PCIEcan devices")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201128133922.3276973-3-zhangqilong3@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/kvaser_pciefd.c')
-rw-r--r-- | drivers/net/can/kvaser_pciefd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c index 72acd1ba162d..43151dd6cb1c 100644 --- a/drivers/net/can/kvaser_pciefd.c +++ b/drivers/net/can/kvaser_pciefd.c @@ -692,8 +692,10 @@ static int kvaser_pciefd_open(struct net_device *netdev) return err; err = kvaser_pciefd_bus_on(can); - if (err) + if (err) { + close_candev(netdev); return err; + } return 0; } |