The function handles one page in one time, allocating umc.retire_unit bad page records is enough. Signed-off-by: Tao Zhou <tao.zhou1@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c index 75ded3904ee7..c0433e6471f5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c @@ -454,7 +454,7 @@ int amdgpu_umc_lookup_bad_pages_in_a_row(struct amdgpu_device *adev, struct ras_err_data err_data; err_data.err_addr = - kcalloc(adev->umc.max_ras_err_cnt_per_query, + kcalloc(adev->umc.retire_unit, sizeof(struct eeprom_table_record), GFP_KERNEL); if(!err_data.err_addr) { dev_warn(adev->dev, "Failed to alloc memory in " @@ -470,7 +470,7 @@ int amdgpu_umc_lookup_bad_pages_in_a_row(struct amdgpu_device *adev, else goto out; - for (i = 0; i < adev->umc.max_ras_err_cnt_per_query; i++) { + for (i = 0; i < adev->umc.retire_unit; i++) { if (pos >= len) goto out; -- 2.34.1