public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
@ 2018-02-15  5:20 Gustavo A. R. Silva
  2018-02-15 12:32 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-15  5:20 UTC (permalink / raw)
  To: Alex Deucher, Christian König, David (ChunMing) Zhou,
	David Airlie
  Cc: amd-gfx, dri-devel, linux-kernel, Gustavo A. R. Silva

Currently, if amdgpu_vm_bo_update() fails, the returned error
is being ignored.

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update.
Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")
Fixes: 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index e48b4ec..db85fc0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -523,12 +523,13 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
 		goto error;
 
 	if (operation == AMDGPU_VA_OP_MAP ||
-	    operation == AMDGPU_VA_OP_REPLACE)
+	    operation == AMDGPU_VA_OP_REPLACE) {
 		r = amdgpu_vm_bo_update(adev, bo_va, false);
+		if (r)
+			goto error;
+	}
 
 	r = amdgpu_vm_update_directories(adev, vm);
-	if (r)
-		goto error;
 
 error:
 	if (r && r != -ERESTARTSYS)
-- 
2.7.4

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

* Re: [PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
  2018-02-15  5:20 [PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm Gustavo A. R. Silva
@ 2018-02-15 12:32 ` Christian König
  2018-02-15 16:11   ` Gustavo A. R. Silva
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2018-02-15 12:32 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Alex Deucher, Christian König,
	David (ChunMing) Zhou, David Airlie
  Cc: Gustavo A. R. Silva, dri-devel, amd-gfx, linux-kernel

Am 15.02.2018 um 06:20 schrieb Gustavo A. R. Silva:
> Currently, if amdgpu_vm_bo_update() fails, the returned error
> is being ignored.
>
> Fix this by properly checking _r_ after calling amdgpu_vm_bo_update.
> Also, remove redundant code just before label _error_.
>
> Addresses-Coverity-ID: 1464280 ("Unused value")
> Fixes: 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index e48b4ec..db85fc0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -523,12 +523,13 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
>   		goto error;
>   
>   	if (operation == AMDGPU_VA_OP_MAP ||
> -	    operation == AMDGPU_VA_OP_REPLACE)
> +	    operation == AMDGPU_VA_OP_REPLACE) {
>   		r = amdgpu_vm_bo_update(adev, bo_va, false);
> +		if (r)
> +			goto error;
> +	}
>   
>   	r = amdgpu_vm_update_directories(adev, vm);
> -	if (r)
> -		goto error;
>   
>   error:
>   	if (r && r != -ERESTARTSYS)

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

* Re: [PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
  2018-02-15 12:32 ` Christian König
@ 2018-02-15 16:11   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2018-02-15 16:11 UTC (permalink / raw)
  To: christian.koenig, Gustavo A. R. Silva, Alex Deucher,
	David (ChunMing) Zhou, David Airlie
  Cc: dri-devel, amd-gfx, linux-kernel



On 02/15/2018 06:32 AM, Christian König wrote:
> Am 15.02.2018 um 06:20 schrieb Gustavo A. R. Silva:
>> Currently, if amdgpu_vm_bo_update() fails, the returned error
>> is being ignored.
>>
>> Fix this by properly checking _r_ after calling amdgpu_vm_bo_update.
>> Also, remove redundant code just before label _error_.
>>
>> Addresses-Coverity-ID: 1464280 ("Unused value")
>> Fixes: 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>
> 

Thanks, Christian
--
Gustavo

>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index e48b4ec..db85fc0 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -523,12 +523,13 @@ static void amdgpu_gem_va_update_vm(struct 
>> amdgpu_device *adev,
>>           goto error;
>>       if (operation == AMDGPU_VA_OP_MAP ||
>> -        operation == AMDGPU_VA_OP_REPLACE)
>> +        operation == AMDGPU_VA_OP_REPLACE) {
>>           r = amdgpu_vm_bo_update(adev, bo_va, false);
>> +        if (r)
>> +            goto error;
>> +    }
>>       r = amdgpu_vm_update_directories(adev, vm);
>> -    if (r)
>> -        goto error;
>>   error:
>>       if (r && r != -ERESTARTSYS)
> 

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

end of thread, other threads:[~2018-02-15 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15  5:20 [PATCH] drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm Gustavo A. R. Silva
2018-02-15 12:32 ` Christian König
2018-02-15 16:11   ` 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