Skip to contentSkip to conversation

drm/amdgpu_vm: fix boolean expressions

PATCH Superseded Gustavo A. R. Silva 2 participants 3 messages Jan 3, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu_vm: fix boolean expressions

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes c8c5e569c5b0 ("drm/amdgpu: Consolidate visible vs. real vram check v2.")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index e73d152659a2..4cc0d1079935 100644
@@ -3006,7 +3006,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	}
 	DRM_DEBUG_DRIVER("VM update mode is %s\n",
 			 vm->use_cpu_for_update ? "CPU" : "SDMA");
-	WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 	vm->last_update = NULL;
 
@@ -3136,7 +3136,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
 	vm->pte_support_ats = pte_support_ats;
 	DRM_DEBUG_DRIVER("VM update mode is %s\n",
 			 vm->use_cpu_for_update ? "CPU" : "SDMA");
-	WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 
 	if (vm->pasid) {
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes c8c5e569c5b0 ("drm/amdgpu: Consolidate visible vs. real vram check v2.")

Actually, this bug goes back further, to 9a4b7d4c769e ("drm/amdgpu: Add vm context module param").

Anyway, the patch is Reviewed-by: Felix Kuehling <[email protected]>

Regards,
  Felix

Quoted 28 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
index e73d152659a2..4cc0d1079935 100644
@@ -3006,7 +3006,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	}
 	DRM_DEBUG_DRIVER("VM update mode is %s\n",
 			 vm->use_cpu_for_update ? "CPU" : "SDMA");
-	WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 	vm->last_update = NULL;
 
@@ -3136,7 +3136,7 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
 	vm->pte_support_ats = pte_support_ats;
 	DRM_DEBUG_DRIVER("VM update mode is %s\n",
 			 vm->use_cpu_for_update ? "CPU" : "SDMA");
-	WARN_ONCE((vm->use_cpu_for_update & !amdgpu_gmc_vram_full_visible(&adev->gmc)),
+	WARN_ONCE((vm->use_cpu_for_update && !amdgpu_gmc_vram_full_visible(&adev->gmc)),
 		  "CPU update of VM recommended only for large BAR system\n");
 
 	if (vm->pasid) {
#2 lore raw
Quoted 10 lines · Felix
Quoted 6 lines · Gustavo A. R. Silva

Fix boolean expressions by using logical AND operator '&&' instead of bitwise operator '&'.

This issue was detected with the help of Coccinelle.

Fixes c8c5e569c5b0 ("drm/amdgpu: Consolidate visible vs. real vram check v2.")

Actually, this bug goes back further, to 9a4b7d4c769e ("drm/amdgpu: Add vm context module param").

You're right. I'll fix that and send v2 shortly. I'll add your RB.

Quoted 2 lines

Anyway, the patch is Reviewed-by: Felix Kuehling <[email protected]>

Thanks
--
Gustavo