Skip to content

Commit 1f511bb

Browse files
Vladimir Zapolskiygregkh
authored andcommitted
media: i2c: og01a1b: Fix V4L2 subdevice data initialization on probe
[ Upstream commit 535b7f1 ] 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: 472377f ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6a0afc7 commit 1f511bb

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

drivers/media/i2c/og01a1b.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ static void og01a1b_remove(struct i2c_client *client)
10421042
struct og01a1b *og01a1b = to_og01a1b(sd);
10431043

10441044
v4l2_async_unregister_subdev(sd);
1045+
v4l2_subdev_cleanup(&og01a1b->sd);
10451046
media_entity_cleanup(&sd->entity);
10461047
v4l2_ctrl_handler_free(sd->ctrl_handler);
10471048
pm_runtime_disable(og01a1b->dev);
@@ -1153,11 +1154,18 @@ static int og01a1b_probe(struct i2c_client *client)
11531154
goto probe_error_v4l2_ctrl_handler_free;
11541155
}
11551156

1157+
ret = v4l2_subdev_init_finalize(&og01a1b->sd);
1158+
if (ret < 0) {
1159+
dev_err_probe(og01a1b->dev, ret,
1160+
"failed to finalize subdevice init\n");
1161+
goto probe_error_media_entity_cleanup;
1162+
}
1163+
11561164
ret = v4l2_async_register_subdev_sensor(&og01a1b->sd);
11571165
if (ret < 0) {
11581166
dev_err(og01a1b->dev, "failed to register V4L2 subdev: %d",
11591167
ret);
1160-
goto probe_error_media_entity_cleanup;
1168+
goto probe_error_v4l2_subdev_cleanup;
11611169
}
11621170

11631171
/* Enable runtime PM and turn off the device */
@@ -1167,6 +1175,9 @@ static int og01a1b_probe(struct i2c_client *client)
11671175

11681176
return 0;
11691177

1178+
probe_error_v4l2_subdev_cleanup:
1179+
v4l2_subdev_cleanup(&og01a1b->sd);
1180+
11701181
probe_error_media_entity_cleanup:
11711182
media_entity_cleanup(&og01a1b->sd.entity);
11721183

0 commit comments

Comments
 (0)