summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-dev.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-19 13:10:56 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 12:39:26 +0100
commit806e5b7cfa96195baadc4cc4663266aaac92e22b (patch)
tree9f53edd254a2e6dcbb1f832dc164b1389db20e7f /drivers/media/video/v4l2-dev.c
parentV4L/DVB (9941): cx24113: fix compile warnings (diff)
downloadlinux-806e5b7cfa96195baadc4cc4663266aaac92e22b.tar.xz
linux-806e5b7cfa96195baadc4cc4663266aaac92e22b.zip
V4L/DVB (9942): v4l2-dev: check for parent device in get_index.
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>
Diffstat (limited to 'drivers/media/video/v4l2-dev.c')
-rw-r--r--drivers/media/video/v4l2-dev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 682f48aadcac..c5ca51a9020a 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -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 &&