[PATCH i-g-t 1/4] tests/kms_content_protection: Avoid using internal pointers

Louis Chauvet <[email protected]> Fri, 31 Jul 2026 20:21:54 +0200
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
output->name is an internal pointer. Replace usage of this pointer by the
existing igt_output_name helper.

Signed-off-by: Louis Chauvet <[email protected]>
---
 tests/kms_content_protection.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index d931ce7682be..133060af3c0a 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -558,7 +558,7 @@ static bool sink_hdcp_capable(igt_output_t *output)
 	char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
 	int fd;
 
-	fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
 	if (fd < 0)
 		return false;
 
@@ -586,7 +586,7 @@ static bool sink_hdcp2_capable(igt_output_t *output)
 	char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
 	int fd;
 
-	fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
 	if (fd < 0)
 		return false;
 
@@ -634,11 +634,11 @@ static bool output_hdcp_capable(igt_output_t *output, int content_type)
 
 		if (content_type && !sink_hdcp2_capable(output)) {
 			igt_info("\tSkip %s (Sink has no HDCP2.2 support)\n",
-				 output->name);
+				 igt_output_name(output));
 			return false;
 		} else if (!sink_hdcp_capable(output)) {
 			igt_info("\tSkip %s (Sink has no HDCP support)\n",
-				 output->name);
+				 igt_output_name(output));
 			return false;
 		}
 
@@ -650,8 +650,8 @@ static void set_i915_force_hdcp14(igt_output_t *output)
 	int fd, ret;
 	char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
 
-	fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
-	igt_require_f(fd >= 0, "Cannot open %s debugfs\n", output->name);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
+	igt_require_f(fd >= 0, "Cannot open %s debugfs\n", igt_output_name(output));
 
 	ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf, sizeof(buf));
 	if (ret <= 0) {
@@ -666,7 +666,7 @@ static void set_i915_force_hdcp14(igt_output_t *output)
 	ret = igt_debugfs_simple_read(fd, "i915_force_hdcp14", buf, sizeof(buf));
 	igt_assert_f(ret > 0 && strstr(buf, "yes"),
 			 "i915_force_hdcp14 is not set to 'yes' on %s debugfs\n",
-			 output->name);
+			 igt_output_name(output));
 
 	close(fd);
 }
@@ -676,8 +676,8 @@ static void reset_i915_force_hdcp14(igt_output_t *output)
 	int fd, ret;
 	char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
 
-	fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
-	igt_require_f(fd >= 0, "Cannot open %s debugfs\n", output->name);
+	fd = igt_debugfs_connector_dir(data.drm_fd, igt_output_name(output), O_RDONLY);
+	igt_require_f(fd >= 0, "Cannot open %s debugfs\n", igt_output_name(output));
 
 	ret = igt_sysfs_write(fd, "i915_force_hdcp14", "0", 2);
 	igt_require_f(ret > 0, "i915_force_hdcp14 is not disabled\n");
@@ -747,7 +747,7 @@ static int get_hdcp_outputs(igt_display_t *display, int content_type,
 
 		if (is_output_hdcp_test_exempt(output)) {
 			igt_info("Skipping HDCP test on %s, as the panel is blocklisted\n",
-				 output->name);
+				 igt_output_name(output));
 			continue;
 		}
 
@@ -796,7 +796,7 @@ test_content_protection(enum igt_commit_style commit_style, int content_type)
 				set_i915_force_hdcp14(output);
 
 			igt_dynamic_f("pipe-%s-%s", igt_crtc_name(crtc),
-				      output->name)
+				      igt_output_name(output))
 				test_content_protection_on_output(output,
 								  crtc,
 								  commit_style,
@@ -935,7 +935,7 @@ test_content_protection_mst(int content_type)
 			}
 		}
 
-		igt_assert_f(pipe_found, "No valid pipe found for %s\n", output->name);
+		igt_assert_f(pipe_found, "No valid pipe found for %s\n", igt_output_name(output));
 
 		igt_output_set_crtc(output, crtc);
 		prepare_modeset_on_mst_output(output, false);
@@ -1012,7 +1012,7 @@ static void test_content_protection_cleanup(void)
 		if (val == CP_UNDESIRED)
 			continue;
 
-		igt_info("CP Prop being UNDESIRED on %s\n", output->name);
+		igt_info("CP Prop being UNDESIRED on %s\n", igt_output_name(output));
 		test_cp_disable(output, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 	}
 

-- 
2.54.0