From fbf1e94f0055d825f8d56b3abe322f37ba818d5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 13 Jun 2017 11:30:35 -0300 Subject: [PATCH] [media] v4l: async: check for v4l2_dev in v4l2_async_notifier_register() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- drivers/media/v4l2-core/v4l2-async.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.20.1