[igt-dev] [PATCH v2] lib/igt_chamelium: Check for error instead of port id for invalid

Mark Yacoub markyacoub at chromium.org
Fri Jul 29 14:51:54 UTC 2022


[Why]
Chamelium V3 has a valid port 0 so 0 should not be rejected.

[How]
Check if there is an error set from g_key_file_get_integer instead of
depending on port id.

v1:
Use GError instead of check for port ID range.

Test: ./kms_chamelium --run-subtest dp-hp
Tested on: Volteer & cv3

Signed-off-by: Mark Yacoub <markyacoub at chromium.org>
---
 lib/igt_chamelium.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index c7b99ebc..fbdb87ac 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -2311,7 +2311,7 @@ static bool chamelium_read_port_mappings(struct chamelium *chamelium,
 		port->id = g_key_file_get_integer(igt_key_file, group,
 						  "ChameliumPortID",
 						  &error);
-		if (!port->id) {
+		if (error) {
 			igt_warn("Failed to read chamelium port ID for %s: %s\n",
 				 map_name, error->message);
 			ret = false;
-- 
2.37.1.455.g008518b4e5-goog



More information about the igt-dev mailing list