[PATCH 2/2] regulator: fp9931: Fix Runtime PM usage count underflow in v3p3 ops
From: robby . cai
Date: Tue Jul 21 2026 - 05:57:12 EST
From: Robby Cai <robby.cai@xxxxxxx>
The fp9931_v3p3_enable() and fp9931_v3p3_disable() callbacks currently
acquire a Runtime PM reference when V3P3 is enabled and release it when
V3P3 is disabled.
This assumes that Runtime PM references remain associated with the V3P3
regulator state. However, FP9931 regulators share common device-level
Runtime PM state and references may be released through other regulator
paths, such as the VCOM control path. In addition, the regulator
framework may invoke disable callbacks during cleanup even when no
corresponding enable callback was executed.
As a result, fp9931_v3p3_disable() may call pm_runtime_put_autosuspend()
when the device runtime PM usage count has already reached 0, triggering:
fp9931 1-0018: Runtime PM usage count underflow!
Fix this by scoping the Runtime PM reference lifetime to the register
access itself, pairing pm_runtime_resume_and_get() and
pm_runtime_put_autosuspend() within each callback.
Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: Robby Cai <robby.cai@xxxxxxx>
---
drivers/regulator/fp9931.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
index 5eee21034f6b..3ffba6fb75ff 100644
--- a/drivers/regulator/fp9931.c
+++ b/drivers/regulator/fp9931.c
@@ -243,8 +243,7 @@ static int fp9931_v3p3_enable(struct regulator_dev *rdev)
return ret;
ret = regulator_enable_regmap(rdev);
- if (ret < 0)
- pm_runtime_put_autosuspend(data->dev);
+ pm_runtime_put_autosuspend(data->dev);
return ret;
}
@@ -254,6 +253,10 @@ static int fp9931_v3p3_disable(struct regulator_dev *rdev)
struct fp9931_data *data = rdev_get_drvdata(rdev);
int ret;
+ ret = pm_runtime_resume_and_get(data->dev);
+ if (ret < 0)
+ return ret;
+
ret = regulator_disable_regmap(rdev);
pm_runtime_put_autosuspend(data->dev);
--
2.50.1