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

Luca Coelho luciano.coelho at intel.com
Thu May 23 08:44:26 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
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 52e00489da70..10a545f173de 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_warn("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