Skip to content

Commit f9a6e56

Browse files
paulkocialkowskimchehab
authored andcommitted
media: sun6i-csi: Register the media device after creation
There is no particular need to register the media device in the subdev notify complete callback. Register it in the v4l2 code instead where it's more in-context. Signed-off-by: Paul Kocialkowski <[email protected]> Acked-by: Jernej Skrabec <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 92cc515 commit f9a6e56

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static int sun6i_subdev_notify_complete(struct v4l2_async_notifier *notifier)
638638
if (ret < 0)
639639
return ret;
640640

641-
return media_device_register(&v4l2->media_dev);
641+
return 0;
642642
}
643643

644644
static const struct v4l2_async_notifier_operations sun6i_csi_async_ops = {
@@ -685,6 +685,12 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev)
685685

686686
media_device_init(media_dev);
687687

688+
ret = media_device_register(media_dev);
689+
if (ret) {
690+
dev_err(dev, "failed to register media device: %d\n", ret);
691+
goto error_media;
692+
}
693+
688694
/* V4L2 Control Handler */
689695

690696
ret = v4l2_ctrl_handler_init(&v4l2->ctrl_handler, 0);
@@ -744,6 +750,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev)
744750
v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
745751

746752
error_media:
753+
media_device_unregister(media_dev);
747754
media_device_cleanup(media_dev);
748755

749756
return ret;

0 commit comments

Comments
 (0)