[PATCH 1/2] drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc15

Quan, Evan Evan.Quan at amd.com
Tue Mar 7 08:16:40 UTC 2023


[AMD Official Use Only - General]

Reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Monday, March 6, 2023 11:54 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: [PATCH 1/2] drm/amdgpu: fix error checking in
> amdgpu_read_mm_registers for soc15
> 
> Properly skip non-existent registers as well.
> 
> Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2442
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/soc15.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c
> b/drivers/gpu/drm/amd/amdgpu/soc15.c
> index 7cd17dda32ce..2eddd7f6cd41 100644
> --- a/drivers/gpu/drm/amd/amdgpu/soc15.c
> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
> @@ -439,8 +439,9 @@ static int soc15_read_register(struct amdgpu_device
> *adev, u32 se_num,
>  	*value = 0;
>  	for (i = 0; i < ARRAY_SIZE(soc15_allowed_read_registers); i++) {
>  		en = &soc15_allowed_read_registers[i];
> -		if (adev->reg_offset[en->hwip][en->inst] &&
> -			reg_offset != (adev->reg_offset[en->hwip][en-
> >inst][en->seg]
> +		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;
> 
> --
> 2.39.2


More information about the amd-gfx mailing list