[igt-dev] [PATCH i-g-t v4 10/11] tests/amdgpu/amd_plane: Ensure pipes are enabled before accessing

Stylon Wang stylon.wang at amd.com
Mon Dec 6 09:02:07 UTC 2021


From: Anson Jacob <Anson.Jacob at amd.com>

Couple of tests were accessing pipe's without ensuring if they are
enabled or not. Using for_each_pipe macro to do so.

Signed-off-by: Anson Jacob <Anson.Jacob at amd.com>
---
 tests/amdgpu/amd_plane.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/amdgpu/amd_plane.c b/tests/amdgpu/amd_plane.c
index 66302ebf..e4c7dca3 100644
--- a/tests/amdgpu/amd_plane.c
+++ b/tests/amdgpu/amd_plane.c
@@ -150,9 +150,9 @@ static void test_init(data_t *data)
 	igt_display_t *display = &data->display;
 	int i, n, max_pipes = display->n_pipes;
 
-	for (i = 0; i < max_pipes; ++i) {
+	for_each_pipe(display, i) {
 		data->pipe_id[i] = PIPE_A + i;
-		data->pipe[i] = &data->display.pipes[data->pipe_id[i]];
+		data->pipe[i] = &display->pipes[data->pipe_id[i]];
 		data->primary[i] = igt_pipe_get_plane_type(
 			data->pipe[i], DRM_PLANE_TYPE_PRIMARY);
 		data->overlay[i] = igt_pipe_get_plane_type_index(
@@ -188,9 +188,9 @@ static void test_init(data_t *data)
 static void test_fini(data_t *data)
 {
 	igt_display_t *display = &data->display;
-	int i, max_pipes = display->n_pipes;
+	int i;
 
-	for (i = 0; i < max_pipes; ++i) {
+	for_each_pipe(display, i) {
 		igt_pipe_crc_free(data->pipe_crc[i]);
 	}
 
-- 
2.33.1



More information about the igt-dev mailing list