[PATCH] drm/amdgpu: fix a warning in get_sdma_rlc_reg_offset

Felix Kuehling felix.kuehling at amd.com
Mon Jan 13 16:23:56 UTC 2020


On 2020-01-08 11:51 p.m., Alex Deucher wrote:
> If a user specifies a non-existant sdma instance,
> warn and return the offset for instance 0.
>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

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


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
> index 2b26925623eb..1f9c6ef7567e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c
> @@ -75,6 +75,11 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,
>   	uint32_t sdma_rlc_reg_offset;
>   
>   	switch (engine_id) {
> +	default:
> +		dev_warn(adev->dev,
> +			 "Invalid sdma engine id (%d), using engine id 0\n",
> +			 engine_id);
> +		/* fall through */
>   	case 0:
>   		sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA0, 0,
>   				mmSDMA0_RLC0_RB_CNTL) - mmSDMA0_RLC0_RB_CNTL;
> @@ -107,8 +112,6 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,
>   		sdma_engine_reg_base = SOC15_REG_OFFSET(SDMA7, 0,
>   				mmSDMA7_RLC0_RB_CNTL) - mmSDMA7_RLC0_RB_CNTL;
>   		break;
> -	default:
> -		break;
>   	}
>   
>   	sdma_rlc_reg_offset = sdma_engine_reg_base


More information about the amd-gfx mailing list