Commit 1e4cbe67 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarJonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 2e6e6095
...@@ -1918,6 +1918,14 @@ int mccic_register(struct mcam_camera *cam) ...@@ -1918,6 +1918,14 @@ int mccic_register(struct mcam_camera *cam)
INIT_LIST_HEAD(&cam->buffers); INIT_LIST_HEAD(&cam->buffers);
mcam_ctlr_init(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. * Try to find the sensor.
*/ */
...@@ -1934,13 +1942,6 @@ int mccic_register(struct mcam_camera *cam) ...@@ -1934,13 +1942,6 @@ int mccic_register(struct mcam_camera *cam)
ret = mcam_cam_init(cam); ret = mcam_cam_init(cam);
if (ret) if (ret)
goto out_unregister; 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); mutex_lock(&cam->s_mutex);
cam->vdev = mcam_v4l_template; cam->vdev = mcam_v4l_template;
...@@ -1960,10 +1961,12 @@ int mccic_register(struct mcam_camera *cam) ...@@ -1960,10 +1961,12 @@ int mccic_register(struct mcam_camera *cam)
} }
out: out:
if (ret)
v4l2_ctrl_handler_free(&cam->ctrl_handler); v4l2_ctrl_handler_free(&cam->ctrl_handler);
mutex_unlock(&cam->s_mutex); mutex_unlock(&cam->s_mutex);
return ret; return ret;
out_unregister: out_unregister:
v4l2_ctrl_handler_free(&cam->ctrl_handler);
v4l2_device_unregister(&cam->v4l2_dev); v4l2_device_unregister(&cam->v4l2_dev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment