summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-12-19 13:10:56 +0100
committerHans Verkuil <hverkuil@xs4all.nl>2008-12-19 13:10:56 +0100
commit2db770287e0d030f614cc7c312c7e5e96041b672 (patch)
treecb9ec65e19a93441b5c204944ab8dc3a7f3486aa /linux/drivers/media
parent4a1ce8a5db70639704279510654844e70138807e (diff)
downloadmediapointer-dvb-s2-2db770287e0d030f614cc7c312c7e5e96041b672.tar.gz
mediapointer-dvb-s2-2db770287e0d030f614cc7c312c7e5e96041b672.tar.bz2
v4l2-dev: check for parent device in get_index.
From: Hans Verkuil <hverkuil@xs4all.nl> 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. Priority: normal Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/v4l2-dev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c
index 3b8f33c8d..91849084f 100644
--- a/linux/drivers/media/video/v4l2-dev.c
+++ b/linux/drivers/media/video/v4l2-dev.c
@@ -194,6 +194,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 &&