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

Karthik B S karthik.b.s at intel.com
Wed Jan 18 06:47:44 UTC 2023


On 1/17/2023 1:35 PM, Mohammed Thasleem wrote:
> Close mcl.fd when drmModeSetCrtc retuns fail and it will
> unblock the resources for other subtests execution with
> out fail.

Hi,

The second part of the message is a little unclear. Could you please 
update this.

>
> 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) {
'if' here looks redundant?
> +		close(mcl.fd);
> +		igt_assert_eq(ret, 0);
> +	}
>   
> +	close(mcl.fd);

This also can be removed once the 'if' condition above is removed.

Thanks,
Karthik.B.S
>   	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