Skip to content

Commit

Permalink
V4L/DVB (9942): v4l2-dev: check for parent device in get_index.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Dec 30, 2008
1 parent cfbd307 commit 806e5b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/media/video/v4l2-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 806e5b7

Please sign in to comment.