Skip to content

Commit bce776f

Browse files
Zhang Qilonggroeck
authored andcommitted
hwmon: (ina3221) Fix PM usage counter unbalance in ina3221_write_enable
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: 323aeb0 ("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>
1 parent b650545 commit bce776f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/hwmon/ina3221.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static int ina3221_write_enable(struct device *dev, int channel, bool enable)
489489

490490
/* For enabling routine, increase refcount and resume() at first */
491491
if (enable) {
492-
ret = pm_runtime_get_sync(ina->pm_dev);
492+
ret = pm_runtime_resume_and_get(ina->pm_dev);
493493
if (ret < 0) {
494494
dev_err(dev, "Failed to get PM runtime\n");
495495
return ret;

0 commit comments

Comments
 (0)