[igt-dev] [i-g-t V3 1/2] lib/igt_kms: Don't read max dotclock on non-display platforms

Bhanuprakash Modem bhanuprakash.modem at intel.com
Thu Nov 16 04:51:12 UTC 2023


On non-display platforms, there is no point in checking for
max dotclock.

V2: Fix resource leak
V3: Drop unwanted 'else'

Fixes: https://gitlab.freedesktop.org/drm/intel/-/issues/9672
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_kms.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 89510ff22..b2208ac54 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6055,10 +6055,18 @@ int igt_get_max_dotclock(int fd)
 	char buf[4096];
 	char *s;
 	int dir, res, max_dotclock = 0;
+	drmModeRes *resources;
 
 	if (!is_intel_device(fd))
 		return max_dotclock;
 
+	/* If there is no display, then no point to check for dotclock. */
+	resources = drmModeGetResources(fd);
+	if (!resources)
+		return max_dotclock;
+
+	drmModeFreeResources(resources);
+
 	dir = igt_debugfs_dir(fd);
 	igt_require(dir);
 
-- 
2.40.0



More information about the igt-dev mailing list