[PATCH v2] drm/amdgpu: Fix missing error code in 'gmc_v6/7/8/9_0_hw_init()'

Christian König christian.koenig at amd.com
Tue Jan 30 09:26:22 UTC 2024


Am 30.01.24 um 09:27 schrieb Srinivasan Shanmugam:
> Return r for success scenairos in 'gmc_v6/7/8/9_0_hw_init()'
>
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c:920 gmc_v6_0_hw_init() warn: missing error code? 'r'
> drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c:1104 gmc_v7_0_hw_init() warn: missing error code? 'r'
> drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c:1224 gmc_v8_0_hw_init() warn: missing error code? 'r'
> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:2347 gmc_v9_0_hw_init() warn: missing error code? 'r'
>
> Fixes: 8301de8fcadc ("drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()'")
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam at amd.com>
> ---
> v2:
>     Changed 'return 0;' to 'return r;' in 'gmc_v9_0_hw_init' in v1.

I think return 0 is actually better since at least in the GMC v6 case 
I've checked the "if(r) return r;" actually guarantees that it's zero.

Regards,
Christian.

>
>   drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++--
>   4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index 229263e407e0..7e53b7b043a8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -916,8 +916,8 @@ static int gmc_v6_0_hw_init(void *handle)
>   
>   	if (amdgpu_emu_mode == 1)
>   		return amdgpu_gmc_vram_checking(adev);
> -	else
> -		return r;
> +
> +	return r;
>   }
>   
>   static int gmc_v6_0_hw_fini(void *handle)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> index d95f719eec55..d30b57820c9c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
> @@ -1100,8 +1100,8 @@ static int gmc_v7_0_hw_init(void *handle)
>   
>   	if (amdgpu_emu_mode == 1)
>   		return amdgpu_gmc_vram_checking(adev);
> -	else
> -		return r;
> +
> +	return r;
>   }
>   
>   static int gmc_v7_0_hw_fini(void *handle)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> index 4eb0cccdb413..5d55e2313345 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
> @@ -1220,8 +1220,8 @@ static int gmc_v8_0_hw_init(void *handle)
>   
>   	if (amdgpu_emu_mode == 1)
>   		return amdgpu_gmc_vram_checking(adev);
> -	else
> -		return r;
> +
> +	return r;
>   }
>   
>   static int gmc_v8_0_hw_fini(void *handle)
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index a3a11538207b..b5651e0426f1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -2343,8 +2343,8 @@ static int gmc_v9_0_hw_init(void *handle)
>   
>   	if (amdgpu_emu_mode == 1)
>   		return amdgpu_gmc_vram_checking(adev);
> -	else
> -		return r;
> +
> +	return r;
>   }
>   
>   /**



More information about the amd-gfx mailing list