All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: fix a warning in get_sdma_rlc_reg_offset
@ 2020-01-09  4:51 Alex Deucher
  2020-01-13 16:23 ` Felix Kuehling
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Deucher @ 2020-01-09  4:51 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

If a user specifies a non-existant sdma instance,
warn and return the offset for instance 0.

Signed-off-by: Alex Deucher <alexander.deucher@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
-- 
2.24.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: fix a warning in get_sdma_rlc_reg_offset
  2020-01-09  4:51 [PATCH] drm/amdgpu: fix a warning in get_sdma_rlc_reg_offset Alex Deucher
@ 2020-01-13 16:23 ` Felix Kuehling
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Kuehling @ 2020-01-13 16:23 UTC (permalink / raw)
  To: amd-gfx, Deucher, Alexander

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@amd.com>

Reviewed-by: Felix Kuehling <Felix.Kuehling@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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2020-01-13 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09  4:51 [PATCH] drm/amdgpu: fix a warning in get_sdma_rlc_reg_offset Alex Deucher
2020-01-13 16:23 ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.