net: fec: Fix reference count leak in fec series ops
authorZhang Qilong <zhangqilong3@huawei.com>
Tue, 10 Nov 2020 09:29:33 +0000 (17:29 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 16 Nov 2020 17:37:01 +0000 (09:37 -0800)
commitda875fa5040b0f951cb4bf7efbf59f6dcff44d3c
treee1a769476e6bcb60afb94016dc6d2ea17a2c28d0
parentdd8088d5a8969dc2b42f71d7bc01c25c61a78066
net: fec: Fix reference count leak in fec series ops

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 count leak. Moreover,
this device cannot enter the idle state and always stay busy or other
non-idle state later. So we fixed it by replacing it with
pm_runtime_resume_and_get.

Fixes: 8fff755e9f8d0 ("net: fec: Ensure clocks are enabled while using mdio bus")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/fec_main.c