[PATCH i-g-t] tools/intel_gpu_frequency: `perror` when opening the sysfs node fails

tranquillitycodes at proton.me tranquillitycodes at proton.me
Sun Mar 31 14:21:05 UTC 2024


This makes the tool more friendly to newcomes who aren't familiar with
it.
---
 tools/intel_gpu_frequency.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/intel_gpu_frequency.c b/tools/intel_gpu_frequency.c
index de0c6ddba..7082ad2b0 100644
--- a/tools/intel_gpu_frequency.c
+++ b/tools/intel_gpu_frequency.c
@@ -84,6 +84,9 @@ initialize_freq_info(struct freq_info *freq_info)
 	freq_info->path = get_sysfs_path(freq_info->name);
 	assert(freq_info->path);
 	freq_info->filp = fopen(freq_info->path, freq_info->mode);
+	if (freq_info->filp == NULL) {
+		perror("Opening the control failed");
+	}
 	assert(freq_info->filp);
 }
 
-- 
2.44.0







More information about the igt-dev mailing list