Skip to content

Commit 0902010

Browse files
outman119broonie
authored andcommitted
regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read()
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: 12d821b ("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>
1 parent 4b73231 commit 0902010

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/regulator/fp9931.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,12 @@ static int fp9931_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
144144
return ret;
145145

146146
ret = regmap_read(data->regmap, FP9931_REG_TMST_VALUE, &val);
147-
if (ret)
148-
return ret;
147+
if (!ret)
148+
*temp = (s8)val * 1000;
149149

150150
pm_runtime_put_autosuspend(data->dev);
151-
*temp = (s8)val * 1000;
152151

153-
return 0;
152+
return ret;
154153
}
155154

156155
static umode_t fp9931_hwmon_is_visible(const void *data,

0 commit comments

Comments
 (0)