From 345ee5051107068b2e1f9f174c8f47ce3bff875b Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Thu, 8 Oct 2026 10:09:27 +0300 Subject: [PATCH] media: ov05c10: Power management fixes If the device wasn't powered on in probe(), probe failure led to it still being powered off. Also the device's PM runtime status was left active when sub-device registration failed and autosuspend was left enabled after unbind. Fix all three issues. Signed-off-by: Sakari Ailus Reviewed-by: Tarang Raval Signed-off-by: Hans Verkuil --- drivers/media/i2c/ov05c10.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov05c10.c b/drivers/media/i2c/ov05c10.c index d6d7ced4beb6..692474cbe84b 100644 --- a/drivers/media/i2c/ov05c10.c +++ b/drivers/media/i2c/ov05c10.c @@ -910,6 +910,8 @@ static int ov05c10_probe(struct i2c_client *client) return 0; probe_error_rpm: + if (full_power) + pm_runtime_set_suspended(&client->dev); pm_runtime_disable(&client->dev); v4l2_subdev_cleanup(&ov05c10->sd); @@ -920,7 +922,8 @@ static int ov05c10_probe(struct i2c_client *client) v4l2_ctrl_handler_free(ov05c10->sd.ctrl_handler); probe_error_power_off: - ov05c10_power_off(&client->dev); + if (full_power) + ov05c10_power_off(&client->dev); return ret; } @@ -934,6 +937,7 @@ static void ov05c10_remove(struct i2c_client *client) v4l2_subdev_cleanup(sd); media_entity_cleanup(&ov05c10->sd.entity); v4l2_ctrl_handler_free(&ov05c10->ctrl_handler); + pm_runtime_dont_use_autosuspend(&client->dev); pm_runtime_disable(&client->dev); if (!pm_runtime_status_suspended(&client->dev)) {