[PATCH i-g-t 1/6] lib/igt_gt: Fix forcewake open

Lucas De Marchi lucas.demarchi at intel.com
Wed Sep 18 16:36:24 UTC 2024


File from the kernel side is read-only and should be open as such:

	debugfs_create_file("i915_forcewake_user", S_IRUSR, minor->debugfs_root,
			    to_i915(minor->dev), &i915_forcewake_fops);

Apparently it doesn't matter for just opening it:

	openat(AT_FDCWD, "/sys/kernel/debug/dri/0", O_RDONLY) = 5
	openat(5, "i915_forcewake_user", O_WRONLY) = 6

But RDONLY is sufficient. Let's stick to the file permission.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 lib/igt_gt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index aa5e75b07..b043e2d41 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -503,7 +503,7 @@ int igt_open_forcewake_handle(int fd)
 {
 	if (getenv("IGT_NO_FORCEWAKE"))
 		return -1;
-	return igt_debugfs_open(fd, "i915_forcewake_user", O_WRONLY);
+	return igt_debugfs_open(fd, "i915_forcewake_user", O_RDONLY);
 }
 
 #if defined(__x86_64__) || defined(__i386__)
-- 
2.46.1



More information about the igt-dev mailing list