[PATCH v2 07/16] media: i2c: ov13b10: power off the sensor on remove
From: Cong Nguyen
Date: Mon Nov 23 2026 - 10:40:29 EST
ov13b10_set_stream() takes a runtime PM reference with
pm_runtime_resume_and_get() when streaming starts and drops it when
streaming stops. ov13b10_remove() calls pm_runtime_disable() and
pm_runtime_set_suspended() but never ov13b10_power_off(), so a device
that is still runtime active when the driver is unbound can keep its clock
and regulators enabled.
After disabling runtime PM, call ov13b10_power_off() if the device is
not already runtime suspended, and only then set the runtime PM status
to suspended. Avoid powering it off again when runtime suspend has
already done so.
This issue was found by auditing the driver with an LLM coding assistant.
Fixes: 7ee850546822 ("media: Add sensor driver support for the ov13b10 camera.")
Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
---
drivers/media/i2c/ov13b10.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c
index f639a70f60dc..b4d67018c983 100644
--- a/drivers/media/i2c/ov13b10.c
+++ b/drivers/media/i2c/ov13b10.c
@@ -1689,7 +1689,10 @@ static void ov13b10_remove(struct i2c_client *client)
ov13b10_free_controls(ov13b);
pm_runtime_disable(ov13b->dev);
- pm_runtime_set_suspended(ov13b->dev);
+ if (!pm_runtime_status_suspended(ov13b->dev)) {
+ ov13b10_power_off(ov13b->dev);
+ pm_runtime_set_suspended(ov13b->dev);
+ }
}
static DEFINE_RUNTIME_DEV_PM_OPS(ov13b10_pm_ops, ov13b10_suspend,
--
2.25.1