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

Karthik B S karthik.b.s at intel.com
Thu Jan 19 06:34:43 UTC 2023


On 1/18/2023 1:03 PM, Mohammed Thasleem wrote:
> Close mcl.fd when drmModeSetCrtc retuns fail and it will
> unblock the resources so that test continue execution on
> another panels.
>
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
> ---
>   tests/kms_lease.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/kms_lease.c b/tests/kms_lease.c
> index 67e8d3be..c870bfd1 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,9 +352,10 @@ 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));

If we've a failure in this check, will this not affect the following 
subtests? Might lead to similar failure?

Thanks,
Karthik.B.S
> -	do_or_die(drmModeSetCrtc(mcl.fd, data->crtc_id, -1,
> -				 0, 0, object_ids, 1, mode));
> +	ret = drmModeSetCrtc(mcl.fd, data->crtc_id, -1, 0, 0, object_ids,
> +			     1, mode);
>   	close(mcl.fd);
> +	igt_assert_eq(ret, 0);
>   
>   	object_ids[mcl.object_count++] = wrong_plane_id;
>   	do_or_die(create_lease(data->master.fd, &mcl));


More information about the igt-dev mailing list