Skip to content

Commit d491920

Browse files
committed
utils: ignore location filters if we already parsed it as "osdev[osdev.type]"
Signed-off-by: Brice Goglin <[email protected]>
1 parent 2e96d2b commit d491920

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

utils/hwloc/hwloc-calc.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ hwloc_calc_parse_level_filter(hwloc_topology_t topology __hwloc_attribute_unused
203203
return -1;
204204
}
205205

206-
} else if (level->type != HWLOC_OBJ_OS_DEVICE) {
206+
} else {
207207
fprintf(stderr, "invalid filter specification %s\n", filter);
208208
return -1;
209209
}
@@ -241,11 +241,14 @@ hwloc_calc_parse_level(struct hwloc_calc_location_context_s *lcontext,
241241
|| level->depth == HWLOC_TYPE_DEPTH_MULTIPLE)
242242
return -1;
243243

244-
bracket = strchr(typestring, '[');
245-
if (bracket) {
246-
err = hwloc_calc_parse_level_filter(topology, bracket+1, level);
247-
if (err < 0)
248-
return -1;
244+
if (level->type != HWLOC_OBJ_OS_DEVICE || hwloc_strncasecmp(typestring, "os", 2) || !level->attr.osdev.type) {
245+
/* don't use filters for OSdev if it was already parsed as "OS*[osdev.type]" */
246+
bracket = strchr(typestring, '[');
247+
if (bracket) {
248+
err = hwloc_calc_parse_level_filter(topology, bracket+1, level);
249+
if (err < 0)
250+
return -1;
251+
}
249252
}
250253
return 0;
251254
}

0 commit comments

Comments
 (0)