[igt-dev] [PATCH i-g-t v3 6/6] tests/fbcon_fbt: Do not keep opening debugfs_fd at every setup_drm() call

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Fri Apr 12 05:51:00 UTC 2019


On Wed, 2019-04-10 at 15:07 -0700, José Roberto de Souza wrote:
> As debugfs_fd is used even after the teardown_drm(), it is not closed
> in this function or in any other place. And then it gets worse as
> every call to setup_drm() will open another file descriptor to
> debugfs dir.
> 
> So lets move the opening of debugfs_fd to setup_environment() and only
> open it once and close it before leave the test.
> 
> Reviewed-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
> ---
>  tests/kms_fbcon_fbt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
> index 67117a24..d534abd2 100644
> --- a/tests/kms_fbcon_fbt.c
> +++ b/tests/kms_fbcon_fbt.c
> @@ -64,7 +64,6 @@ static void setup_drm(struct drm_info *drm)
>  		return;
>  
>  	drm->fd = drm_open_driver_master(DRIVER_INTEL);
> -	drm->debugfs_fd = igt_debugfs_dir(drm->fd);
>  
>  	drm->res = drmModeGetResources(drm->fd);
>  	igt_require(drm->res);
> @@ -295,6 +294,7 @@ static void setup_environment(struct drm_info *drm)
Looks like the hunk from the previous patch should have been here.

>  
>  	drm_fd = drm_open_driver_master(DRIVER_INTEL);
>  	igt_require(drm_fd >= 0);
> +	drm->debugfs_fd = igt_debugftos_dir(drm_fd);
With an igt_require( >= 0) and hunk moved
Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
 
>  	igt_assert(close(drm_fd) == 0);
>  
>  	/*
> @@ -309,6 +309,8 @@ static void teardown_environment(struct drm_info *drm)
>  {
>  	if (drm->fd >= 0)
>  		teardown_drm(drm);
> +
> +	close(drm->debugfs_fd);
>  }
>  
>  igt_main



More information about the igt-dev mailing list