On 2023-12-20 21:00, Srinivasan Shanmugam wrote:
The list has the head node, the NULL pointer check is therefore
superfluous, Hence removed it.
Fixes the below:
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1347 kfd_create_indirect_link_prop() warn: can 'gpu_link' even be NULL?
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1428 kfd_add_peer_prop() warn: can 'iolink1' even be NULL?
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_topology.c:1433 kfd_add_peer_prop() warn: can 'iolink2' even be NULL?
Cc: Felix Kuehling <Felix.Kuehling@xxxxxxx>
Cc: Christian König <christian.koenig@xxxxxxx>
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>
---
drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index dc7c8312e8c7..141a8b3273c8 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1344,8 +1344,6 @@ static int kfd_create_indirect_link_prop(struct kfd_topology_device *kdev, int g
gpu_link = list_first_entry(&kdev->io_link_props,
struct kfd_iolink_properties, list);
- if (!gpu_link)
- return -ENOMEM;
I think the problem here is that list_first_entry expects the list to
not be empty. So the correct solution would be to add a !list_empty
check before using list_first_entry.
Regards,
Felix
for (i = 0; i < num_cpu; i++) {
/* CPU <--> GPU */
@@ -1425,13 +1423,9 @@ static int kfd_add_peer_prop(struct kfd_topology_device *kdev,
iolink1 = list_first_entry(&kdev->io_link_props,
struct kfd_iolink_properties, list);
- if (!iolink1)
- return -ENOMEM;
iolink2 = list_first_entry(&peer->io_link_props,
struct kfd_iolink_properties, list);
- if (!iolink2)
- return -ENOMEM;
props = kfd_alloc_struct(props);
if (!props)