drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()'
authorjsg <jsg@openbsd.org>
Tue, 6 Feb 2024 03:58:02 +0000 (03:58 +0000)
committerjsg <jsg@openbsd.org>
Tue, 6 Feb 2024 03:58:02 +0000 (03:58 +0000)
From Srinivasan Shanmugam
b02831b8a5b687138df4662ff914aa3defc2499e in linux-6.6.y/6.6.16
fac4ebd79fed60e79cccafdad45a2bb8d3795044 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c

index ad76a75..4b975ec 100644 (file)
@@ -885,21 +885,28 @@ int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
         * seconds, so here, we just pick up three parts for emulation.
         */
        ret = memcmp(vram_ptr, cptr, 10);
-       if (ret)
-               return ret;
+       if (ret) {
+               ret = -EIO;
+               goto release_buffer;
+       }
 
        ret = memcmp(vram_ptr + (size / 2), cptr, 10);
-       if (ret)
-               return ret;
+       if (ret) {
+               ret = -EIO;
+               goto release_buffer;
+       }
 
        ret = memcmp(vram_ptr + size - 10, cptr, 10);
-       if (ret)
-               return ret;
+       if (ret) {
+               ret = -EIO;
+               goto release_buffer;
+       }
 
+release_buffer:
        amdgpu_bo_free_kernel(&vram_bo, &vram_gpu,
                        &vram_ptr);
 
-       return 0;
+       return ret;
 }
 
 static ssize_t current_memory_partition_show(