Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2] tests/kms_content_protection: Fix uevent subtest
@ 2019-12-12 12:35 Anshuman Gupta
  2019-12-12 12:52 ` Ramalingam C
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Anshuman Gupta @ 2019-12-12 12:35 UTC (permalink / raw)
  To: igt-dev

uevent hdcp subtest was failing because hdcp_event()
has been called with NULL udev_monitor, which was
causing udev_monitor_receive_device() to return a
NULL udev.

v2: Using double pointer for udev_monitor and udev. [Ram]

Cc: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 tests/kms_content_protection.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index e676b60b..eb279c4e 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -165,24 +165,24 @@ static void hdcp_udev_fini(struct udev_monitor *uevent_monitor,
 		udev_unref(udev);
 }
 
-static int hdcp_udev_init(struct udev_monitor *uevent_monitor,
-			  struct udev *udev)
+static int hdcp_udev_init(struct udev_monitor **uevent_monitor,
+			  struct udev **udev, int *udev_fd)
 {
 	int ret = -EINVAL;
 
-	udev = udev_new();
-	if (!udev) {
+	*udev = udev_new();
+	if (!*udev) {
 		igt_info("failed to create udev object\n");
 		goto out;
 	}
 
-	uevent_monitor = udev_monitor_new_from_netlink(udev, "udev");
-	if (!uevent_monitor) {
+	*uevent_monitor = udev_monitor_new_from_netlink(*udev, "udev");
+	if (!*uevent_monitor) {
 		igt_info("failed to create udev event monitor\n");
 		goto out;
 	}
 
-	ret = udev_monitor_filter_add_match_subsystem_devtype(uevent_monitor,
+	ret = udev_monitor_filter_add_match_subsystem_devtype(*uevent_monitor,
 							      "drm",
 							      "drm_minor");
 	if (ret < 0) {
@@ -190,16 +190,23 @@ static int hdcp_udev_init(struct udev_monitor *uevent_monitor,
 		goto out;
 	}
 
-	ret = udev_monitor_enable_receiving(uevent_monitor);
+	ret = udev_monitor_enable_receiving(*uevent_monitor);
 	if (ret < 0) {
 		igt_info("failed to enable udev event reception\n");
 		goto out;
 	}
 
-	return udev_monitor_get_fd(uevent_monitor);
+	*udev_fd = udev_monitor_get_fd(*uevent_monitor);
+	if (*udev_fd < 0) {
+		igt_info("failed to get udev_fd on uevent monitor\n");
+		ret = *udev_fd;
+		goto out;
+	}
+
+	return ret;
 
 out:
-	hdcp_udev_fini(uevent_monitor, udev);
+	hdcp_udev_fini(*uevent_monitor, *udev);
 	return ret;
 }
 
@@ -214,8 +221,7 @@ static bool wait_for_hdcp_event(uint32_t conn_id, uint32_t prop_id,
 	struct epoll_event event, events[MAX_EVENTS];
 	bool ret = false;
 
-	udev_fd = hdcp_udev_init(uevent_monitor, udev);
-	if (udev_fd < 0)
+	if (hdcp_udev_init(&uevent_monitor, &udev, &udev_fd) < 0)
 		return false;
 
 	epoll_fd = epoll_create1(0);
-- 
2.24.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-13 13:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-12 12:35 [igt-dev] [PATCH i-g-t v2] tests/kms_content_protection: Fix uevent subtest Anshuman Gupta
2019-12-12 12:52 ` Ramalingam C
2019-12-12 13:15 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_content_protection: Fix uevent subtest (rev2) Patchwork
2019-12-13  2:35 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-12-13  3:24   ` Anshuamn Gupta
2019-12-13  8:11     ` Vudum, Lakshminarayana
2019-12-13  8:03 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2019-12-13 13:22 ` [igt-dev] [PATCH i-g-t v2] tests/kms_content_protection: Fix uevent subtest Ramalingam C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox