[PATCH v2 16/16] media: i2c: tc358746: power off the bridge on remove
From: Cong Nguyen
Date: Mon Nov 23 2026 - 10:41:24 EST
The driver uses runtime PM autosuspend with a one second delay and
drops its references with pm_runtime_put_sync_autosuspend(), so after
the last use the device stays runtime active until the delay expires.
tc358746_remove() only calls pm_runtime_disable() and
pm_runtime_set_suspended(), which neither run the runtime suspend
callback nor release the supplies and the reference clock. Unbinding
within that delay, or while streaming, can leave them enabled.
After disabling runtime PM, call tc358746_suspend() if the device is
not runtime suspended, and only then set the runtime PM status to
suspended.
This issue was found by auditing the driver with an LLM coding assistant.
Fixes: 80a21da36051 ("media: tc358746: add Toshiba TC358746 Parallel to CSI-2 bridge driver")
Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
---
drivers/media/i2c/tc358746.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/tc358746.c b/drivers/media/i2c/tc358746.c
index 88ff4a90eebc..68f483534e0f 100644
--- a/drivers/media/i2c/tc358746.c
+++ b/drivers/media/i2c/tc358746.c
@@ -1688,7 +1688,10 @@ static void tc358746_remove(struct i2c_client *client)
media_entity_cleanup(&sd->entity);
pm_runtime_disable(sd->dev);
- pm_runtime_set_suspended(sd->dev);
+ if (!pm_runtime_status_suspended(sd->dev)) {
+ tc358746_suspend(sd->dev);
+ pm_runtime_set_suspended(sd->dev);
+ }
pm_runtime_dont_use_autosuspend(sd->dev);
}
--
2.25.1