summaryrefslogtreecommitdiff
path: root/lib/igt_chamelium.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-10-05 09:07:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-10-16 20:26:12 +0100
commit0ac43db33e116b546e5704fe0b4dde21f391e09c (patch)
treef1b2fa7ff52cbc4c87d430ec3cd5b6ef4742f51f /lib/igt_chamelium.c
parent959d6f95cb1344e0c0dace5b236e17755826fac1 (diff)
lib/chamelium: Check drmModeGetResources()
If KMS is not available, drmModeGetResoures() reports NULL and so we cannot use this device to find the chamelium connector. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Diffstat (limited to 'lib/igt_chamelium.c')
-rw-r--r--lib/igt_chamelium.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index b8418e13..a80ead16 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1422,6 +1422,10 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium,
int port_i, i, j;
bool ret = true;
+ res = drmModeGetResources(drm_fd);
+ if (!res)
+ return false;
+
group_list = g_key_file_get_groups(igt_key_file, NULL);
/* Count how many connector mappings are specified in the config */
@@ -1433,7 +1437,6 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium,
chamelium->ports = calloc(sizeof(struct chamelium_port),
chamelium->port_count);
port_i = 0;
- res = drmModeGetResources(drm_fd);
for (i = 0; group_list[i] != NULL; i++) {
group = group_list[i];
@@ -1494,8 +1497,8 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium,
}
out:
- drmModeFreeResources(res);
g_strfreev(group_list);
+ drmModeFreeResources(res);
return ret;
}