[PATCH] drm/amdkfd: Drop redundant NULL pointer check in kfd_topology.c

Srinivasan Shanmugam srinivasan.shanmugam at amd.com
Thu Dec 21 02:00:24 UTC 2023


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 at amd.com>
Cc: Christian König <christian.koenig at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
---
 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;
 
 	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)
-- 
2.34.1



More information about the amd-gfx mailing list