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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>

Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>


---
  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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux