diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-03-05 18:00:11 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-01 13:41:46 +0300 |
commit | 1e4cbe677f596563060709b3af92480f873a0a6e (patch) | |
tree | fa2326bab1af5e1181c4bc814eee953618277ced /drivers/media/platform/marvell-ccic | |
parent | 2e6e609530a1f4306b8fb3e2c4d6abff9d9be30e (diff) | |
download | linux-1e4cbe677f596563060709b3af92480f873a0a6e.tar.xz |
[media] marvell-ccic: control handler fixes
No controls were reported, even though the ov7670 does have controls.
Two reasons for this: the v4l2_ctrl_handler_init() call must come
before the ov7670 is loaded (otherwise the ov7670 won't know that
its controls should be added to the bridge driver), and the
v4l2_ctrl_handler_free() call at the end should only be called if
the ret value is non-zero (otherwise you would just free all the
controls that were just added).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/marvell-ccic')
-rw-r--r-- | drivers/media/platform/marvell-ccic/mcam-core.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c index 7e54cef09d54..51c9c8c69d03 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.c +++ b/drivers/media/platform/marvell-ccic/mcam-core.c @@ -1919,6 +1919,14 @@ int mccic_register(struct mcam_camera *cam) mcam_ctlr_init(cam); /* + * Get the v4l2 setup done. + */ + ret = v4l2_ctrl_handler_init(&cam->ctrl_handler, 10); + if (ret) + goto out_unregister; + cam->v4l2_dev.ctrl_handler = &cam->ctrl_handler; + + /* * Try to find the sensor. */ sensor_cfg.clock_speed = cam->clock_speed; @@ -1934,13 +1942,6 @@ int mccic_register(struct mcam_camera *cam) ret = mcam_cam_init(cam); if (ret) goto out_unregister; - /* - * Get the v4l2 setup done. - */ - ret = v4l2_ctrl_handler_init(&cam->ctrl_handler, 10); - if (ret) - goto out_unregister; - cam->v4l2_dev.ctrl_handler = &cam->ctrl_handler; mutex_lock(&cam->s_mutex); cam->vdev = mcam_v4l_template; @@ -1960,10 +1961,12 @@ int mccic_register(struct mcam_camera *cam) } out: - v4l2_ctrl_handler_free(&cam->ctrl_handler); + if (ret) + v4l2_ctrl_handler_free(&cam->ctrl_handler); mutex_unlock(&cam->s_mutex); return ret; out_unregister: + v4l2_ctrl_handler_free(&cam->ctrl_handler); v4l2_device_unregister(&cam->v4l2_dev); return ret; } |