drm/amdgpu: fix error checking in amdgpu_read_mm_registers for nv
Subsystems (2)
Alex Deucher
maintainerPATCH 1/1 drm/amdgpu: fix error checking in amdgpu_read_mm_registers for nv
Properly skip non-existent registers as well.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/nv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +4 -3
@@ -444,9 +444,10 @@ static int nv_read_register(struct amdgpu_device *adev, u32 se_num, *value =0 ;for (i =0 ; i <ARRAY_SIZE (nv_allowed_read_registers); i++) { en = &nv_allowed_read_registers[i]; -if (adev->reg_offset[en->hwip][en->inst] && - reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] - + en->reg_offset)) +if (!adev->reg_offset[en->hwip][en->inst]) +continue ; +else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] + + en->reg_offset))continue ; *value = nv_get_register_value(adev,
Signature · 1 line
2.39.2
Reviewed-by Hawking Zhang <[email protected]>
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, March 7, 2023 22:02
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: fix error checking in amdgpu_read_mm_registers for nv
Properly skip non-existent registers as well.
Signed-off-by Alex Deucher <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/nv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +4 -3
@@ -444,9 +444,10 @@ static int nv_read_register(struct amdgpu_device *adev, u32 se_num, *value =0 ;for (i =0 ; i <ARRAY_SIZE (nv_allowed_read_registers); i++) { en = &nv_allowed_read_registers[i]; -if (adev->reg_offset[en->hwip][en->inst] && - reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] - + en->reg_offset)) +if (!adev->reg_offset[en->hwip][en->inst]) +continue ; +else if (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg] + + en->reg_offset))continue ; *value = nv_get_register_value(adev,
--
2.39.2