ov13b10_remove() disables runtime PM and marks the device suspended, but does not power off the sensor if it is still runtime active. pm_runtime_disable() prevents further runtime PM callbacks, but does not force the runtime suspend callback to run. If the sensor is active when the driver is removed, pm_runtime_set_suspended() only updates the runtime PM state while the imaging clock and regulators can remain enabled and the reset line can remain deasserted. After disabling runtime PM, check whether the device is already suspended and call ov13b10_power_off() if it is still active. Avoid calling the power-off helper for an already suspended device to prevent unbalanced clock and regulator disable operations. This issue was found by manual code inspection. Fixes: 6e28afd152280 ("media: ov13b10: add PM control support based on power resources") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li --- drivers/media/i2c/ov13b10.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c index b0d34141a13a..6d57da39c371 100644 --- a/drivers/media/i2c/ov13b10.c +++ b/drivers/media/i2c/ov13b10.c @@ -1688,6 +1688,8 @@ static void ov13b10_remove(struct i2c_client *client) ov13b10_free_controls(ov13b); pm_runtime_disable(ov13b->dev); + if (!pm_runtime_status_suspended(ov13b->dev)) + ov13b10_power_off(ov13b->dev); pm_runtime_set_suspended(ov13b->dev); } -- 2.43.0