power: supply: bq24190_charger: Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Mon, 25 May 2020 11:05:40 +0000 (19:05 +0800)
committerSebastian Reichel <sre@kernel.org>
Fri, 19 Jun 2020 17:01:16 +0000 (19:01 +0200)
pm_runtime_get_sync() increments the runtime PM usage counter even
it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq24190_charger.c

index 4540e913057f15cde4c79b290a2e2b992491aea2..d14186525e1e90d6ecc1f315d2dae3277907c18f 100644 (file)
@@ -481,8 +481,10 @@ static ssize_t bq24190_sysfs_store(struct device *dev,
                return ret;
 
        ret = pm_runtime_get_sync(bdi->dev);
-       if (ret < 0)
+       if (ret < 0) {
+               pm_runtime_put_noidle(bdi->dev);
                return ret;
+       }
 
        ret = bq24190_write_mask(bdi, info->reg, info->mask, info->shift, v);
        if (ret)