Skip to content

Commit 38afc20

Browse files
committed
distances: fix the return value of get_by_type() for special types
Signed-off-by: Brice Goglin <[email protected]>
1 parent 7a4168f commit 38afc20

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/hwloc/distances.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ hwloc_distances_get_by_type(hwloc_topology_t topology, hwloc_obj_type_t type,
132132
unsigned long kind, unsigned long flags)
133133
{
134134
int depth = hwloc_get_type_depth(topology, type);
135-
if (depth < 0)
135+
if (depth < 0) {
136+
*nr = 0;
136137
return 0;
138+
}
137139
return hwloc_distances_get_by_depth(topology, depth, nr, distances, kind, flags);
138140
}
139141

0 commit comments

Comments
 (0)