[PATCH] drm/amdkfd: set "r = 0" explicitly before goto

Felix Kuehling felix.kuehling at amd.com
Fri Nov 26 23:44:38 UTC 2021


[+Dan]

On 2021-11-26 1:42 p.m., Philip Yang wrote:

> To silence the following Smatch static checker warning:
>
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:2615
> svm_range_restore_pages()
> 	warn: missing error code here? 'get_task_mm()' failed. 'r' = '0'
>
> Signed-off-by: Philip Yang <Philip.Yang at amd.com>

Please credit Dan Carpenter with a Suggested-by tag.

Dan pointed out two more success paths in the same function. I believe 
he meant, those should also set r = 0 explicitly.

Regards,
   Felix


> ---
>   drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 663489ae56d7..a74154c5aa05 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> @@ -2603,6 +2603,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>   
>   	if (atomic_read(&svms->drain_pagefaults)) {
>   		pr_debug("draining retry fault, drop fault 0x%llx\n", addr);
> +		r = 0;
>   		goto out;
>   	}
>   
> @@ -2612,6 +2613,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>   	mm = get_task_mm(p->lead_thread);
>   	if (!mm) {
>   		pr_debug("svms 0x%p failed to get mm\n", svms);
> +		r = 0;
>   		goto out;
>   	}
>   


More information about the amd-gfx mailing list