[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201128133922.3276973-3-zhangqilong3@huawei.com>
Date: Sat, 28 Nov 2020 21:39:22 +0800
From: Zhang Qilong <zhangqilong3@...wei.com>
To: <wg@...ndegger.com>, <mkl@...gutronix.de>, <davem@...emloft.net>,
<kuba@...nel.org>
CC: <netdev@...r.kernel.org>, <linux-can@...r.kernel.org>
Subject: [PATCH 2/2] can: kvaser_pciefd: Fix error handling in kvaser_pciefd_open
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@...wei.com>
---
drivers/net/can/kvaser_pciefd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/kvaser_pciefd.c b/drivers/net/can/kvaser_pciefd.c
index 1bafa614950e..969cedb9b0b6 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;
}
--
2.25.4
Powered by blists - more mailing lists