From: Hans Verkuil Date: Wed, 25 Jan 2017 07:38:07 +0000 (-0200) Subject: [media] v4l2-ctrls.c: add NULL check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=814e92b8cadf73ee79f689ec48f64408f3904d19;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [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 Reported-by: Shaobo Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- 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) { struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id); + if (ctrl == NULL) + return; + v4l2_ctrl_lock(ctrl); list_del(&sev->node); v4l2_ctrl_unlock(ctrl);