[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 Feb 2 11:38:13 UTC 2023


On 2/1/2023 3:42 PM, Mohammed Thasleem wrote:
> Close mcl.fd even when drmModeSetCrtc retuns fail.
> This will unblock the resources, so that test can
> continue to execute on another panels.
>
> v2: Removed if loop and updated the description. (Karthik)
>
> v3: Added igt_assert_eq for both master fd and mcl fd. (Karthik)
>
> v4: Minor updates in description. (Karthik)
>
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
Reviewed-by: Karthik B S <karthik.b.s at intel.com>
> ---
>   tests/kms_lease.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tests/kms_lease.c b/tests/kms_lease.c
> index 67e8d3be..6bd5bc15 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, ret_mcl = 0;
>   	igt_output_t *output =
>   		connector_id_to_output(&data->master.display,
>   				       data->connector_id);
> @@ -349,11 +350,13 @@ static void setcrtc_implicit_plane(data_t *data)
>   	igt_assert_eq(0, prepare_crtc(&data->master, 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));
> +	ret = drmModeSetCrtc(data->master.fd, data->crtc_id, -1,
> +			     0, 0, object_ids, 1, mode);
> +	ret_mcl = drmModeSetCrtc(mcl.fd, data->crtc_id, -1,
> +				 0, 0, object_ids, 1, mode);
>   	close(mcl.fd);
> +	igt_assert_eq(ret, 0);
> +	igt_assert_eq(ret_mcl, 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