diff mbox series

[3/8] gard: Fix up path parsing

Message ID 20171130053129.22642-3-oohall@gmail.com
State Accepted
Headers show
Series [1/8] gard: Allow records with an ID of 0xffffffff | expand

Commit Message

Oliver O'Halloran Nov. 30, 2017, 5:31 a.m. UTC
Currently we assume that the Unit ID can be used as an array index into
the chip_units[] structure. There are holes in the ID space though, so
this doesn't actually work. Fix it up by walking the array looking for
the ID.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 external/gard/gard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/external/gard/gard.c b/external/gard/gard.c
index c70fa2a3ccfd..5a57415ab5a7 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -325,7 +325,7 @@  int parse_path(const char *str, struct entity_path *parsed)
 		parsed->path_elements[unit_count].target_type = unit_id;
 
 		/* now parse the instance # */
-		len = strlen(chip_units[unit_id].desc);
+		len = strlen(target_type_to_str(unit_id));
 		instance = strtol(str + len, &end, 10);
 
 		if (!isdigit(*(str + len))) {