]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read()
authorFelix Gu <ustc.gu@gmail.com>
Tue, 24 Feb 2026 10:07:59 +0000 (18:07 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 24 Feb 2026 17:31:54 +0000 (17:31 +0000)
In fp9931_hwmon_read(), if regmap_read() failed, the function returned
the error code without calling pm_runtime_put_autosuspend(), causing
a PM reference leak.

Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Reviewed-by: Andreas Kemnade <andreas@kemnade.info>
Link: https://patch.msgid.link/20260224-fp9931-v1-1-1cf05cabef4a@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/fp9931.c

index 7fbcc6327cc635cbd814873348ccb00aeba20e0f..abea3b69d8a085eda3f1d52ce7e1a6dd24500d70 100644 (file)
@@ -144,13 +144,12 @@ static int fp9931_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
                return ret;
 
        ret = regmap_read(data->regmap, FP9931_REG_TMST_VALUE, &val);
-       if (ret)
-               return ret;
+       if (!ret)
+               *temp = (s8)val * 1000;
 
        pm_runtime_put_autosuspend(data->dev);
-       *temp = (s8)val * 1000;
 
-       return 0;
+       return ret;
 }
 
 static umode_t fp9931_hwmon_is_visible(const void *data,