[media] v4l: async: check for v4l2_dev in v4l2_async_notifier_register()
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tue, 13 Jun 2017 14:30:35 +0000 (11:30 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 20 Jun 2017 12:08:17 +0000 (09:08 -0300)
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 <niklas.soderlund+renesas@ragnatech.se>
Acked-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>
drivers/media/v4l2-core/v4l2-async.c

index cbd919d4edd27e17b7ad8fe39444351f2dd23ec7..c16200c88417b151c8751d050aa60633b8d7bc1b 100644 (file)
@@ -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;