Skip to contentSkip to conversation

drm/amdkfd: fix comparison warning with min() macro

PATCH In review Alex Deucher 3 participants 3 messages Mar 24, 2022 – Mar 25, 2022

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdkfd: fix comparison warning with min() macro

Properly case to u32 to fix the warning.

Fixes 83f1287c57228f ("drm/amdkfd: Fix Incorrect VMIDs passed to HWS")
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -1
index d70f787369a0..62aa6c9d5123 100644
@@ -484,7 +484,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	/* Verify module parameters regarding mapped process number*/
 	if (hws_max_conc_proc >= 0)
-		kfd->max_proc_per_quantum = min(hws_max_conc_proc, kfd->vm_info.vmid_num_kfd);
+		kfd->max_proc_per_quantum = min((u32)hws_max_conc_proc, kfd->vm_info.vmid_num_kfd);
 	else
 		kfd->max_proc_per_quantum = kfd->vm_info.vmid_num_kfd;
 
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 2022-03-24 um 17:31 schrieb Alex Deucher:

Quoted 4 lines

Properly case to u32 to fix the warning.

Fixes 83f1287c57228f ("drm/amdkfd: Fix Incorrect VMIDs passed to HWS")
Quoted 17 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -1
index d70f787369a0..62aa6c9d5123 100644
@@ -484,7 +484,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
  	/* Verify module parameters regarding mapped process number*/
  	if (hws_max_conc_proc >= 0)
-		kfd->max_proc_per_quantum = min(hws_max_conc_proc, kfd->vm_info.vmid_num_kfd);
+		kfd->max_proc_per_quantum = min((u32)hws_max_conc_proc, kfd->vm_info.vmid_num_kfd);
  	else
  		kfd->max_proc_per_quantum = kfd->vm_info.vmid_num_kfd;
 
maintainer
#2 lore raw
In reply to Alex Deucher

Am 24.03.22 um 22:31 schrieb Alex Deucher:

Quoted 13 lines

Properly case to u32 to fix the warning.

Fixes 83f1287c57228f ("drm/amdkfd: Fix Incorrect VMIDs passed to HWS")
---
  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index d70f787369a0..62aa6c9d5123 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c bool kgd2kfd_device_init(struct kfd_dev *kfd, · line 487

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +1 -1
@@ -484,7 +484,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
  	/* Verify module parameters regarding mapped process number*/
  	if (hws_max_conc_proc >= 0)
-		kfd->max_proc_per_quantum = min(hws_max_conc_proc, kfd->vm_info.vmid_num_kfd);
+		kfd->max_proc_per_quantum = min((u32)hws_max_conc_proc, kfd->vm_info.vmid_num_kfd);

You could use min_t() her instead of the manual casting.

Christian.

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
  	else
  		kfd->max_proc_per_quantum = kfd->vm_info.vmid_num_kfd;