Skip to content

Commit b1a428b

Browse files
srishanmalexdeucher
authored andcommitted
drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()'
Fix the following about iterator use: drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1456 kfd_add_peer_prop() warn: iterator used outside loop: 'iolink3' Cc: Felix Kuehling <[email protected]> Cc: Christian König <[email protected]> Cc: Alex Deucher <[email protected]> Signed-off-by: Srinivasan Shanmugam <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent bf2ad4f commit b1a428b

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_topology.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,17 +1452,19 @@ static int kfd_add_peer_prop(struct kfd_topology_device *kdev,
14521452
/* CPU->CPU link*/
14531453
cpu_dev = kfd_topology_device_by_proximity_domain(iolink1->node_to);
14541454
if (cpu_dev) {
1455-
list_for_each_entry(iolink3, &cpu_dev->io_link_props, list)
1456-
if (iolink3->node_to == iolink2->node_to)
1457-
break;
1458-
1459-
props->weight += iolink3->weight;
1460-
props->min_latency += iolink3->min_latency;
1461-
props->max_latency += iolink3->max_latency;
1462-
props->min_bandwidth = min(props->min_bandwidth,
1463-
iolink3->min_bandwidth);
1464-
props->max_bandwidth = min(props->max_bandwidth,
1465-
iolink3->max_bandwidth);
1455+
list_for_each_entry(iolink3, &cpu_dev->io_link_props, list) {
1456+
if (iolink3->node_to != iolink2->node_to)
1457+
continue;
1458+
1459+
props->weight += iolink3->weight;
1460+
props->min_latency += iolink3->min_latency;
1461+
props->max_latency += iolink3->max_latency;
1462+
props->min_bandwidth = min(props->min_bandwidth,
1463+
iolink3->min_bandwidth);
1464+
props->max_bandwidth = min(props->max_bandwidth,
1465+
iolink3->max_bandwidth);
1466+
break;
1467+
}
14661468
} else {
14671469
WARN(1, "CPU node not found");
14681470
}

0 commit comments

Comments
 (0)