[igt-dev] [PATCH] lib/igt_chamelium: Extend check of valid ports to port=0

Mark Yacoub markyacoub at chromium.org
Fri Jul 15 19:22:00 UTC 2022


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

[How]
Check for port values between 0 and CHAMELIUM_MAX_PORTS which should
also include the V2 ports 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 55cbfa12..5d68372b 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 (port->id < 0 || port->id > CHAMELIUM_MAX_PORTS) {
 			igt_warn("Failed to read chamelium port ID for %s: %s\n",
 				 map_name, error->message);
 			ret = false;
-- 
2.37.0.170.g444d1eabd0-goog



More information about the igt-dev mailing list