diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-05-29 11:45:43 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-06-07 08:53:42 -0300 |
commit | 48e3e36a253c66d47843ebe78422cec30095e3d5 (patch) | |
tree | 5e65e5d6c07329f034630c557a2312195a4003fc /drivers/media/v4l2-core | |
parent | cc0140e2a04513ccdd950d939729e557d23cc910 (diff) |
[media] v4l2-ctrls: Correctly destroy mutex in v4l2_ctrl_handler_free()
The mutex that was initialised in v4l2_ctrl_handler_init_class() was not
destroyed in v4l2_ctrl_handler_free(). Do that.
Additionally, explicitly refer to the ctrl handler's mutex in mutex
initialisation for clarity.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index dec55d53d24a..5aed7bd20ad2 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1739,8 +1739,8 @@ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, unsigned nr_of_controls_hint, struct lock_class_key *key, const char *name) { + mutex_init(&hdl->_lock); hdl->lock = &hdl->_lock; - mutex_init(hdl->lock); lockdep_set_class_and_name(hdl->lock, key, name); INIT_LIST_HEAD(&hdl->ctrls); INIT_LIST_HEAD(&hdl->ctrl_refs); @@ -1780,6 +1780,7 @@ void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl) hdl->cached = NULL; hdl->error = 0; mutex_unlock(hdl->lock); + mutex_destroy(&hdl->_lock); } EXPORT_SYMBOL(v4l2_ctrl_handler_free); |