linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu_vm: fix boolean expressions
@ 2019-01-03 17:34 Gustavo A. R. Silva
  2019-01-03 19:17 ` Kuehling, Felix
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-03 17:34 UTC (permalink / raw)
  Cc: amd-gfx, dri-devel, linux-kernel, 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.")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e73d152659a2..4cc0d1079935 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -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.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu_vm: fix boolean expressions
  2019-01-03 17:34 [PATCH] drm/amdgpu_vm: fix boolean expressions Gustavo A. R. Silva
@ 2019-01-03 19:17 ` Kuehling, Felix
  2019-01-03 19:52   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Kuehling, Felix @ 2019-01-03 19:17 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: dri-devel, amd-gfx, linux-kernel

On 2019-01-03 12:34 p.m., Gustavo A. R. Silva wrote:
> 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 <Felix.Kuehling@amd.com>

Regards,
  Felix


> Cc: stable@vger.kernel.org
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index e73d152659a2..4cc0d1079935 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -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) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu_vm: fix boolean expressions
  2019-01-03 19:17 ` Kuehling, Felix
@ 2019-01-03 19:52   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-01-03 19:52 UTC (permalink / raw)
  To: Kuehling, Felix; +Cc: dri-devel, amd-gfx, linux-kernel



On 1/3/19 1:17 PM, Kuehling, Felix wrote:
> On 2019-01-03 12:34 p.m., Gustavo A. R. Silva wrote:
>> 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.

> Anyway, the patch is Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> 

Thanks
--
Gustavo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-03 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03 17:34 [PATCH] drm/amdgpu_vm: fix boolean expressions Gustavo A. R. Silva
2019-01-03 19:17 ` Kuehling, Felix
2019-01-03 19:52   ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).