lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1441296036-20727-5-git-send-email-javier@osg.samsung.com>
Date:	Thu,  3 Sep 2015 18:00:35 +0200
From:	Javier Martinez Canillas <javier@....samsung.com>
To:	linux-kernel@...r.kernel.org
Cc:	Hans Verkuil <hans.verkuil@...co.com>,
	Javier Martinez Canillas <javier@....samsung.com>,
	Mauro Carvalho Chehab <mchehab@....samsung.com>,
	Laurent Pinchart <laurent.pinchart@...asonboard.com>,
	linux-media@...r.kernel.org
Subject: [PATCH 4/5] [media] uvcvideo: create pad links after subdev registration

The uvc driver creates the pads links before the media entity is
registered with the media device. This doesn't work now that obj
IDs are used to create links so the media_device has to be set.

Move entities registration logic before pads links creation.

Signed-off-by: Javier Martinez Canillas <javier@....samsung.com>
---

 drivers/media/usb/uvc/uvc_entity.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 429e428ccd93..9dde1f86cc4b 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -37,6 +37,10 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
 	if (sink == NULL)
 		return 0;
 
+	ret = v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
+	if (ret < 0)
+		return ret;
+
 	for (i = 0; i < entity->num_pads; ++i) {
 		struct media_entity *source;
 		struct uvc_entity *remote;
@@ -46,8 +50,10 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
 			continue;
 
 		remote = uvc_entity_by_id(chain->dev, entity->baSourceID[i]);
-		if (remote == NULL)
-			return -EINVAL;
+		if (remote == NULL) {
+			ret = -EINVAL;
+			goto error;
+		}
 
 		source = (UVC_ENTITY_TYPE(remote) == UVC_TT_STREAMING)
 		       ? (remote->vdev ? &remote->vdev->entity : NULL)
@@ -59,13 +65,15 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
 		ret = media_create_pad_link(source, remote_pad,
 					       sink, i, flags);
 		if (ret < 0)
-			return ret;
+			goto error;
 	}
 
 	if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
 		return 0;
 
-	return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
+error:
+	v4l2_device_unregister_subdev(&entity->subdev);
+	return ret;
 }
 
 static struct v4l2_subdev_ops uvc_subdev_ops = {
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ