[PATCH v2 02/16] media: i2c: hi556: power off the sensor on remove

From: Cong Nguyen

Date: Mon Nov 23 2026 - 10:39:50 EST


hi556_set_stream() takes a runtime PM reference with
pm_runtime_resume_and_get() when streaming starts and drops it when
streaming stops. hi556_remove() only calls pm_runtime_disable(), which
does not run the runtime suspend callback, so a device that is still
runtime active when the driver is unbound can keep its clock and regulators
enabled and its reset line released.

The probe error path already calls hi556_suspend() when the sensor was
powered on. After disabling runtime PM in remove(), do the same if the
device is not runtime suspended, and 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: e62138403a84 ("media: hi556: Add support for Hi-556 sensor")
Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
---
drivers/media/i2c/hi556.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
index a151bab26821..0d1d52d79a79 100644
--- a/drivers/media/i2c/hi556.c
+++ b/drivers/media/i2c/hi556.c
@@ -1424,6 +1424,10 @@ static void hi556_remove(struct i2c_client *client)
media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(sd->ctrl_handler);
pm_runtime_disable(hi556->dev);
+ if (!pm_runtime_status_suspended(hi556->dev)) {
+ hi556_suspend(hi556->dev);
+ pm_runtime_set_suspended(hi556->dev);
+ }
mutex_destroy(&hi556->mutex);
}

--
2.25.1