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 <sakari.ailus@linux.intel.com>
Reviewed-by: Tarang Raval <tarang.raval@siliconsignals.io>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Sakari Ailus 2026-10-08 10:09:27 +03:00 committed by Hans Verkuil
parent 6525548afe
commit 345ee50511

View File

@ -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)) {