Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 806e5b7c authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent cfbd3072
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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 &&