Am 04.01.24 um 11:04 schrieb Srinivasan Shanmugam:
The amdgpu_gmc_vram_checking() function in emulation checks whether
all of the memory range of shared system memory could be accessed by
GPU, from this aspect, -EIO is returned for error scenarios.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c:919 gmc_v6_0_hw_init() warn: missing 
error code? 'r'
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c:1103 gmc_v7_0_hw_init() warn: missing 
error code? 'r'
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c:1223 gmc_v8_0_hw_init() warn: missing 
error code? 'r'
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:2344 gmc_v9_0_hw_init() warn: missing 
error code? 'r'

Cc: Xiaojian Du <[email protected]>
Cc: Lijo Lazar <[email protected]>
Cc: Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>
Signed-off-by: Srinivasan Shanmugam <[email protected]>
Suggested-by: Christian König <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index d2f273d77e59..de9576b243aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -1046,15 +1046,15 @@ int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
         */
        ret = memcmp(vram_ptr, cptr, 10);
        if (ret)
-               return ret;
+               return -EIO;
ret = memcmp(vram_ptr + (size / 2), cptr, 10);
        if (ret)
-               return ret;
+               return -EIO;
ret = memcmp(vram_ptr + size - 10, cptr, 10);
        if (ret)
-               return ret;
+               return -EIO;

Not a fault of this patch, but the error handling here is broken as well.

In other words when memcmp() fails we don't release the temporary buffer.

Probably a good idea to fix that as well while at it.

Regards,
Christian.

amdgpu_bo_free_kernel(&vram_bo, &vram_gpu,
                        &vram_ptr);

Reply via email to