aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_chamelium.c7
-rw-r--r--lib/igt_chamelium.h7
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index 7198df63..2a49bf56 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -121,7 +121,7 @@ struct chamelium {
int drm_fd;
struct igt_list edids;
- struct chamelium_port *ports;
+ struct chamelium_port ports[CHAMELIUM_MAX_PORTS];
int port_count;
};
@@ -1804,11 +1804,9 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium,
if (strstr(group_list[i], "Chamelium:"))
chamelium->port_count++;
}
+ igt_assert(chamelium->port_count <= CHAMELIUM_MAX_PORTS);
- chamelium->ports = calloc(sizeof(struct chamelium_port),
- chamelium->port_count);
port_i = 0;
-
for (i = 0; group_list[i] != NULL; i++) {
group = group_list[i];
@@ -2008,7 +2006,6 @@ void chamelium_deinit(struct chamelium *chamelium)
for (i = 0; i < chamelium->port_count; i++)
free(chamelium->ports[i].name);
- free(chamelium->ports);
free(chamelium);
}
diff --git a/lib/igt_chamelium.h b/lib/igt_chamelium.h
index 7f77745f..b6b7eb44 100644
--- a/lib/igt_chamelium.h
+++ b/lib/igt_chamelium.h
@@ -68,6 +68,13 @@ struct chamelium_audio_file {
struct chamelium_edid;
/**
+ * CHAMELIUM_MAX_PORTS: the maximum number of ports supported by igt_chamelium.
+ *
+ * For now, we have 1 VGA, 1 HDMI and 2 DisplayPort ports.
+ */
+#define CHAMELIUM_MAX_PORTS 4
+
+/**
* CHAMELIUM_DEFAULT_EDID: provide this ID to #chamelium_port_set_edid to use
* the default EDID.
*/