]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: check save count before RAS bad page saving
authorTao Zhou <tao.zhou1@amd.com>
Wed, 15 Oct 2025 08:19:07 +0000 (16:19 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 20 Oct 2025 22:25:49 +0000 (18:25 -0400)
It's possible that unit_num is larger than 0 but save_count is zero,
since we do get bad page address but the address is invalid. Check
unit_num and save_count together.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Candice Li <candice.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index bc3f34c2c2d613f4779c02c500f05081039664b2..60b42c652e7eeb8172a34dc773deb15d689bb617 100644 (file)
@@ -3142,7 +3142,7 @@ int amdgpu_ras_save_bad_pages(struct amdgpu_device *adev,
                *new_cnt = unit_num;
 
        /* only new entries are saved */
-       if (unit_num > 0) {
+       if (unit_num && save_count) {
                /*old asics only save pa to eeprom like before*/
                if (IP_VERSION_MAJ(amdgpu_ip_version(adev, UMC_HWIP, 0)) < 12) {
                        if (amdgpu_ras_eeprom_append(control,