]> git.baikalelectronics.ru Git - kernel.git/commit
can: flexcan: fix failure handling of pm_runtime_get_sync()
authorZhang Qilong <zhangqilong3@huawei.com>
Sun, 8 Nov 2020 08:30:00 +0000 (16:30 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 15 Nov 2020 17:24:35 +0000 (18:24 +0100)
commit7e6d9149de432e3dbef5c474050f9375b5f8333b
treeb2acbc2ea86357321cca70546b8033632f6cca17
parentebbddea769f92907bbc4118fc3e2bcd7aeea1f39
can: flexcan: fix failure handling of pm_runtime_get_sync()

pm_runtime_get_sync() will increment pm usage at first and it will resume the
device later. If runtime of the device has error or device is in inaccessible
state(or other error state), resume operation will fail. If we do not call put
operation to decrease the reference, it will result in reference leak in the
two functions flexcan_get_berr_counter() and flexcan_open().

Moreover, this device cannot enter the idle state and always stay busy or other
non-idle state later. So we should fix it through adding
pm_runtime_put_noidle().

Fixes: 91e9ccddd332c ("can: flexcan: implement can Runtime PM")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201108083000.2599705-1-zhangqilong3@huawei.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/flexcan.c