]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (9942): v4l2-dev: check for parent device in get_index.
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 19 Dec 2008 12:10:56 +0000 (09:10 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 30 Dec 2008 11:39:26 +0000 (09:39 -0200)
get_index requires a valid parent device in order to discover which
indices are in use. Some drivers (e.g. pvrusb2) do not set the parent
device. In that case just return 0.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-dev.c

index 682f48aadcac342f36579ddac5f89d6ea8120de3..c5ca51a9020a9a1b42da4e91925bb2113a0411c1 100644 (file)
@@ -162,6 +162,10 @@ static int get_index(struct video_device *vdev, int num)
                return -EINVAL;
        }
 
+       /* Some drivers do not set the parent. In that case always return 0. */
+       if (vdev->parent == NULL)
+               return 0;
+
        for (i = 0; i < VIDEO_NUM_DEVICES; i++) {
                if (video_device[i] != NULL &&
                    video_device[i] != vdev &&