diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2017-01-25 02:38:07 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-02-03 08:24:48 -0500 |
commit | 814e92b8cadf73ee79f689ec48f64408f3904d19 (patch) | |
tree | e9829d147922ab3ce6231b4366287a211b67175a | |
parent | 75d1b1379fba4ca2fb6fb7b70141ac0afb807fbf (diff) |
[media] v4l2-ctrls.c: add NULL check
Check that the control whose events we want to delete is still there.
Normally this will always be the case, but I am not 100% certain if
there aren't any corner cases when a device is forcibly unbound.
In any case, this will satisfy static checkers and simply make it more
robust.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Shaobo <shaobo@cs.utah.edu>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-ctrls.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 47001e25fd9e..b9e08e3d6e0e 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c | |||
@@ -3367,6 +3367,9 @@ static void v4l2_ctrl_del_event(struct v4l2_subscribed_event *sev) | |||
3367 | { | 3367 | { |
3368 | struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id); | 3368 | struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id); |
3369 | 3369 | ||
3370 | if (ctrl == NULL) | ||
3371 | return; | ||
3372 | |||
3370 | v4l2_ctrl_lock(ctrl); | 3373 | v4l2_ctrl_lock(ctrl); |
3371 | list_del(&sev->node); | 3374 | list_del(&sev->node); |
3372 | v4l2_ctrl_unlock(ctrl); | 3375 | v4l2_ctrl_unlock(ctrl); |