[PATCH v4 2/3] lib/igt_kms: Correct the check for igt_require

Mohammed Thasleem mohammed.thasleem at intel.com
Wed Jan 17 14:13:22 UTC 2024


The function 'igt_debugfs_dir()' returns -1, if it fails and a non-negative
fd otherwise. However in the function igt_get_max_dotclock() the condition
to check the debugfs directory uses igt_require (dir), which fails even if
the dir is 0.
So correct the igt_require check for a valid igt_debugfs fd.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
---
 lib/igt_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e4dea1a60..21338d026 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6100,7 +6100,7 @@ int igt_get_max_dotclock(int fd)
 	drmModeFreeResources(resources);
 
 	dir = igt_debugfs_dir(fd);
-	igt_require(dir);
+	igt_require(dir != 0);
 
 	/*
 	 * Display specific clock frequency info is moved to i915_cdclk_info,
-- 
2.25.1



More information about the igt-dev mailing list