[PATCH i-g-t v2 2/2] tests/intel: check drmModeGetConnector() return in i915_pm_rpm

Luca Coelho luciano.coelho at intel.com
Tue May 28 07:58:55 UTC 2024


The drmModeGetConnector() function can return NULL in some cases, so
we need to check the return value before accessing it.  This is not
being checked in init_mode_set_data(), so fix that.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10911
Cc: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
---
 tests/intel/i915_pm_rpm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
index 0ea5fbd8afd9..3b4034f24a57 100644
--- a/tests/intel/i915_pm_rpm.c
+++ b/tests/intel/i915_pm_rpm.c
@@ -515,6 +515,12 @@ static void init_mode_set_data(struct mode_set_data *data)
 			data->connectors[i] =
 				drmModeGetConnector(drm_fd,
 						    data->res->connectors[i]);
+			if (!data->connectors[i]) {
+				igt_debug("Could not read connector %u\n",
+					  data->res->connectors[i]);
+				continue;
+			}
+
 			data->edids[i] = get_connector_edid(data->connectors[i], i);
 		}
 
-- 
2.39.2



More information about the igt-dev mailing list