Skip to contentSkip to conversation

media: i2c: ov13b10: fix power leak on remove while runtime-active

PATCH New Cong Nguyen 1 participant 1 message Sep 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: i2c: ov13b10: fix power leak on remove while runtime-active

ov13b10_remove() calls pm_runtime_set_suspended(), but that's pure bookkeeping -- it doesn't call ov13b10_suspend() (which actually deasserts reset, disables the regulators, and disables/unprepares the clock via ov13b10_power_off()).

If unbound while ov13b10_set_stream() is holding an outstanding PM reference (removed while actively streaming), the device stays genuinely active with regulators/clock enabled forever after.

Call ov13b10_suspend() in that case, guarded by pm_runtime_status_suspended() so the common already-suspended case isn't suspended twice -- same guard sibling imx412.c's remove() uses.

Fixes 7ee850546822 ("media: Add sensor driver support for the ov13b10 camera.")
Assisted-by LLM
---
 drivers/media/i2c/ov13b10.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/ov13b10.c +2 -0
index b0d34141a13a..ab5cf9af2e85 100644
@@ -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_suspend(ov13b->dev);
 	pm_runtime_set_suspended(ov13b->dev);
 }
 
Signature · 1 line
2.25.1