Skip to content

Commit

Permalink
can: kvaser_pciefd: kvaser_pciefd_open(): fix error handling
Browse files Browse the repository at this point in the history
If kvaser_pciefd_bus_on() failed, we should call close_candev() to avoid
reference leak.

Fixes: 26ad340 ("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>
  • Loading branch information
Zhang Qilong authored and marckleinebudde committed Nov 30, 2020
1 parent 44cef0c commit 13a84cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/can/kvaser_pciefd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 13a84cf

Please sign in to comment.