[PATCH] media: i2c: vd55g1: fix runtime PM cleanup on probe failure
From: Guangshuo Li
Date: Tue Sep 15 2026 - 06:26:46 EST
vd55g1_probe() takes a runtime PM reference with
pm_runtime_get_noresume() and drops it with pm_runtime_put_autosuspend()
before initializing and registering the V4L2 subdevice.
If either of those later operations fails, the error path calls
pm_runtime_put_noidle() again even though the runtime PM reference has
already been released. The extra put has no matching get operation.
The autosuspend request may also have suspended the device before the
probe failure path is reached. In that case, unconditionally calling
vd55g1_power_off() can disable the clock and regulators a second time.
Drop the unmatched pm_runtime_put_noidle(), only power off the sensor
when it is not already runtime suspended, and set the runtime PM state
to suspended afterwards. This also makes the probe failure cleanup
consistent with the driver remove path.
This issue was found by manual code inspection.
Fixes: e56616d7b23c ("media: i2c: Add driver for ST VD55G1 camera sensor")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
---
drivers/media/i2c/vd55g1.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/vd55g1.c b/drivers/media/i2c/vd55g1.c
index 6f458f611f63..eb5a601cb22e 100644
--- a/drivers/media/i2c/vd55g1.c
+++ b/drivers/media/i2c/vd55g1.c
@@ -2055,9 +2055,10 @@ static int vd55g1_probe(struct i2c_client *client)
vd55g1_subdev_cleanup(sensor);
err_power_off:
pm_runtime_disable(dev);
- pm_runtime_put_noidle(dev);
+ if (!pm_runtime_status_suspended(dev))
+ vd55g1_power_off(dev);
+ pm_runtime_set_suspended(dev);
pm_runtime_dont_use_autosuspend(dev);
- vd55g1_power_off(dev);
return ret;
}
--
2.43.0