]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable
authorZhang Qilong <zhangqilong3@huawei.com>
Wed, 2 Dec 2020 14:53:20 +0000 (22:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:51:17 +0000 (11:51 +0100)
commitbfdf000e5dd92a97938446ba4524d659f3f1e533
tree8dbae746778e98c44b35ffa9286e390193f4778d
parenta0f07c9ad72d7ac983cc3ca766b27ff1de63b8c4
hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable

[ Upstream commit bce776f10069c806290eaac712ba73432ae8ecd7 ]

pm_runtime_get_sync will increment pm usage counter
even it failed. Forgetting to putting operation will
result in reference leak here. We fix it by replacing
it with pm_runtime_resume_and_get to keep usage counter
balanced. It depends on the mainline commit[PM: runtime:
Add pm_runtime_resume_and_get to deal with usagecounter].

Fixes: 323aeb0eb5d9a ("hwmon: (ina3221) Add PM runtime support")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201202145320.1135614-1-zhangqilong3@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hwmon/ina3221.c