v4l2-event: v4l2_event_queue: do nothing if vdev == NULL
Hans Verkuil [Tue, 23 Jun 2015 09:20:23 +0000 (06:20 -0300)]
If the vdev pointer == NULL, then just return.

This makes it easier for subdev drivers to use this function without having to
check if the sd->devnode pointer is NULL or not.

Bug 1770474

Change-Id: I4d9798b58ea13e987dcf50442a96694a8f803291
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Ken Chang <kenc@nvidia.com>
Reviewed-on: http://git-master/r/1154256
(cherry picked from commit 4e09f1b068c7f67926258f6b0a802fe5691ccd4b)
Signed-off-by: Ahung Cheng <ahcheng@nvidia.com>
Reviewed-on: http://git-master/r/1165707
Reviewed-by: Hayden Du <haydend@nvidia.com>

drivers/media/v4l2-core/v4l2-event.c

index 8761aab..8d3171c 100644 (file)
@@ -172,6 +172,9 @@ void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev)
        unsigned long flags;
        struct timespec timestamp;
 
+       if (vdev == NULL)
+               return;
+
        ktime_get_ts(&timestamp);
 
        spin_lock_irqsave(&vdev->fh_lock, flags);