drm/amdgpu/soc15: fix nullptr issue in soc15_read_register() for reg base accessing
authorPrike.Liang <Prike.Liang@amd.com>
Mon, 8 Jun 2020 07:20:56 +0000 (15:20 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Jul 2020 05:59:18 +0000 (01:59 -0400)
The failed case is no SDMA1 IP for Renoir discovery table while in accessing SDMA1 reg base,
thus need have nullptr test for soc15_read_register invoked in MMR addres space inquire opt.

Signed-off-by: Prike.Liang <Prike.Liang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/soc15.c

index 623745b2d8b3c56f4cc33846b212b1b7021a56bc..3e406eeeaff66f6842884bc24aea78b1f91a1718 100644 (file)
@@ -415,7 +415,8 @@ 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 (reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
+               if (adev->reg_offset[en->hwip][en->inst] &&
+                       reg_offset != (adev->reg_offset[en->hwip][en->inst][en->seg]
                                        + en->reg_offset))
                        continue;