[igt-dev] [PATCH i-g-t] tests/kms_lease: close mcl.fd when drmModeSetCrtc fails

Mohammed Thasleem mohammed.thasleem at intel.com
Tue Jan 17 08:05:07 UTC 2023


Close mcl.fd when drmModeSetCrtc retuns fail and it will
unblock the resources for other subtests execution with
out fail.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 tests/kms_lease.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index 67e8d3be..c1cf8567 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -317,6 +317,7 @@ static void setcrtc_implicit_plane(data_t *data)
 	struct drm_mode_create_lease mcl;
 	drmModePlaneRes *plane_resources;
 	uint32_t wrong_plane_id = 0;
+	int ret = 0;
 	igt_output_t *output =
 		connector_id_to_output(&data->master.display,
 				       data->connector_id);
@@ -351,10 +352,14 @@ static void setcrtc_implicit_plane(data_t *data)
 	/* sanity check */
 	do_or_die(drmModeSetCrtc(data->master.fd, data->crtc_id, -1,
 				 0, 0, object_ids, 1, mode));
-	do_or_die(drmModeSetCrtc(mcl.fd, data->crtc_id, -1,
-				 0, 0, object_ids, 1, mode));
-	close(mcl.fd);
+	ret = drmModeSetCrtc(mcl.fd, data->crtc_id, -1, 0, 0, object_ids,
+			     1, mode);
+	if (ret) {
+		close(mcl.fd);
+		igt_assert_eq(ret, 0);
+	}
 
+	close(mcl.fd);
 	object_ids[mcl.object_count++] = wrong_plane_id;
 	do_or_die(create_lease(data->master.fd, &mcl));
 
-- 
2.25.1



More information about the igt-dev mailing list