mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 03:24:19 +02:00
media: i2c: og01a1b: Fix V4L2 subdevice data initialization on probe
It's necessary to finalize the camera sensor subdevice initialization on
driver probe and clean V4L2 subdevice data up on error paths and driver
removal.
The change fixes a previously reported by v4l2-compliance issue of
the failed VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT test:
fail: v4l2-test-controls.cpp(1104): subscribe event for control 'User Controls' failed
Fixes: 472377febf ("media: Add a driver for the og01a1b camera sensor")
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
9206359b2c
commit
535b7f1069
|
|
@ -1042,6 +1042,7 @@ static void og01a1b_remove(struct i2c_client *client)
|
|||
struct og01a1b *og01a1b = to_og01a1b(sd);
|
||||
|
||||
v4l2_async_unregister_subdev(sd);
|
||||
v4l2_subdev_cleanup(&og01a1b->sd);
|
||||
media_entity_cleanup(&sd->entity);
|
||||
v4l2_ctrl_handler_free(sd->ctrl_handler);
|
||||
pm_runtime_disable(og01a1b->dev);
|
||||
|
|
@ -1153,11 +1154,18 @@ static int og01a1b_probe(struct i2c_client *client)
|
|||
goto probe_error_v4l2_ctrl_handler_free;
|
||||
}
|
||||
|
||||
ret = v4l2_subdev_init_finalize(&og01a1b->sd);
|
||||
if (ret < 0) {
|
||||
dev_err_probe(og01a1b->dev, ret,
|
||||
"failed to finalize subdevice init\n");
|
||||
goto probe_error_media_entity_cleanup;
|
||||
}
|
||||
|
||||
ret = v4l2_async_register_subdev_sensor(&og01a1b->sd);
|
||||
if (ret < 0) {
|
||||
dev_err(og01a1b->dev, "failed to register V4L2 subdev: %d",
|
||||
ret);
|
||||
goto probe_error_media_entity_cleanup;
|
||||
goto probe_error_v4l2_subdev_cleanup;
|
||||
}
|
||||
|
||||
/* Enable runtime PM and turn off the device */
|
||||
|
|
@ -1167,6 +1175,9 @@ static int og01a1b_probe(struct i2c_client *client)
|
|||
|
||||
return 0;
|
||||
|
||||
probe_error_v4l2_subdev_cleanup:
|
||||
v4l2_subdev_cleanup(&og01a1b->sd);
|
||||
|
||||
probe_error_media_entity_cleanup:
|
||||
media_entity_cleanup(&og01a1b->sd.entity);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user