v4l2_fh_init() can be used to initialise dummy file-handles with vdev ==
NULL.

Signed-off-by: Guennadi Liakhovetski <g.liakhovet...@gmx.de>
---
 drivers/media/v4l2-core/v4l2-fh.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-fh.c 
b/drivers/media/v4l2-core/v4l2-fh.c
index e57c002..7ae608b 100644
--- a/drivers/media/v4l2-core/v4l2-fh.c
+++ b/drivers/media/v4l2-core/v4l2-fh.c
@@ -33,10 +33,12 @@
 void v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev)
 {
        fh->vdev = vdev;
-       /* Inherit from video_device. May be overridden by the driver. */
-       fh->ctrl_handler = vdev->ctrl_handler;
+       if (vdev) {
+               /* Inherit from video_device. May be overridden by the driver. 
*/
+               fh->ctrl_handler = vdev->ctrl_handler;
+               set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags);
+       }
        INIT_LIST_HEAD(&fh->list);
-       set_bit(V4L2_FL_USES_V4L2_FH, &fh->vdev->flags);
        fh->prio = V4L2_PRIORITY_UNSET;
        init_waitqueue_head(&fh->wait);
        INIT_LIST_HEAD(&fh->available);
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to