From: Niklas Söderlund Date: Tue, 13 Jun 2017 14:30:35 +0000 (-0300) Subject: [media] v4l: async: check for v4l2_dev in v4l2_async_notifier_register() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fbf1e94f0055d825f8d56b3abe322f37ba818d5a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git [media] v4l: async: check for v4l2_dev in v4l2_async_notifier_register() Add a check for v4l2_dev to v4l2_async_notifier_register() as to fail as early as possible since this will fail later in v4l2_async_test_notify(). Signed-off-by: Niklas Söderlund Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index cbd919d4edd2..c16200c88417 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -148,7 +148,8 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, struct v4l2_async_subdev *asd; int i; - if (!notifier->num_subdevs || notifier->num_subdevs > V4L2_MAX_SUBDEVS) + if (!v4l2_dev || !notifier->num_subdevs || + notifier->num_subdevs > V4L2_MAX_SUBDEVS) return -EINVAL; notifier->v4l2_dev = v4l2_dev;