linux_kernel/drivers/net/can/c_can
Zhang Qilong 44cef0c0ff can: c_can: c_can_power_up(): fix error handling
In the error handling in c_can_power_up(), there are two bugs:

1) c_can_pm_runtime_get_sync() will increase usage counter if device is not
   empty. Forgetting to call c_can_pm_runtime_put_sync() will result in a
   reference leak here.

2) c_can_reset_ram() operation will set start bit when enable is true. We
   should clear it in the error handling.

We fix it by adding c_can_pm_runtime_put_sync() for 1), and
c_can_reset_ram(enable is false) for 2) in the error handling.

Fixes: 8212003260 ("can: c_can: Add d_can suspend resume support")
Fixes: 52cde85acc ("can: c_can: Add d_can raminit support")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201128133922.3276973-2-zhangqilong3@huawei.com
[mkl: return "0" instead of "ret"]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2020-11-30 12:43:55 +01:00
..
c_can_pci.c can: c_can_pci: make c_can_pci_data const 2017-12-01 09:14:22 +01:00
c_can_platform.c can: c_can: c_can_plaform: fix checkpatch warnings 2019-11-11 21:58:08 +01:00
c_can.c can: c_can: c_can_power_up(): fix error handling 2020-11-30 12:43:55 +01:00
c_can.h can: c_can: reg_map_{c,d}_can: mark as __maybe_unused 2020-10-06 22:44:26 +02:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00