[igt-dev] [PATCH i-g-t 2/2] tools/intel_pm_rpm: Only init debufs_fd if needed.

Petri Latvala petri.latvala at intel.com
Tue Nov 1 09:02:57 UTC 2022


On Mon, Oct 31, 2022 at 03:58:59PM -0400, Rodrigo Vivi wrote:
> So we can run a --setup-d3cold without depending on the presence
> of a debugfs.
> 
> Cc: Anshuman Gupta <anshuman.gupta at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>


For the series:
Reviewed-by: Petri Latvala <petri.latvala at intel.com>


> ---
>  tools/intel_pm_rpm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/intel_pm_rpm.c b/tools/intel_pm_rpm.c
> index 05d7f6fb..17cd2bc1 100644
> --- a/tools/intel_pm_rpm.c
> +++ b/tools/intel_pm_rpm.c
> @@ -197,10 +197,9 @@ int main(int argc, char *argv[])
>  		goto exit;
>  	}
>  
> -	data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
> -
>  	data.res = drmModeGetResources(data.drm_fd);
>  	if (data.res) {
> +		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
>  		kmstest_set_vt_graphics_mode();
>  		igt_display_require(&data.display, data.drm_fd);
>  
> @@ -240,7 +239,8 @@ exit:
>  	if (data.res)
>  		igt_display_fini(&data.display);
>  
> -	close(data.debugfs_fd);
> +	if (data.debugfs_fd)
> +		close(data.debugfs_fd);
>  	close(data.drm_fd);
>  	igt_devices_free();
>  
> -- 
> 2.37.3
> 


More information about the igt-dev mailing list