[AMD Official Use Only - General] Reviewed-by: Evan Quan <evan.quan@xxxxxxx> > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Alex > Deucher > Sent: Monday, March 6, 2023 11:54 PM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx> > 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@xxxxxxx> > --- > 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