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

Felix Kuehling felix.kuehling at amd.com
Mon Nov 29 18:05:33 UTC 2021


Am 2021-11-29 um 9:05 a.m. schrieb Philip Yang:
> 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>
> Suggested-by: Dan Carpenter <dan.carpenter at oracle.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling at amd.com>


> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
> index 663489ae56d7..187e8ab66baa 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;
>  	}
>  
> @@ -2649,6 +2651,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>  
>  	if (svm_range_skip_recover(prange)) {
>  		amdgpu_gmc_filter_faults_remove(adev, addr, pasid);
> +		r = 0;
>  		goto out_unlock_range;
>  	}
>  
> @@ -2657,6 +2660,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,
>  	if (timestamp < AMDGPU_SVM_RANGE_RETRY_FAULT_PENDING) {
>  		pr_debug("svms 0x%p [0x%lx %lx] already restored\n",
>  			 svms, prange->start, prange->last);
> +		r = 0;
>  		goto out_unlock_range;
>  	}
>  


More information about the amd-gfx mailing list