drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()'

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]>
Reviewed-by: Christian König <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
This commit is contained in:
Srinivasan Shanmugam
2024-01-15 18:31:59 -05:00
committed by Alex Deucher
parent 30d8dffab7
commit fac4ebd79f
+14 -7
View File
@@ -1045,21 +1045,28 @@ int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
* seconds, so here, we just pick up three parts for emulation. * seconds, so here, we just pick up three parts for emulation.
*/ */
ret = memcmp(vram_ptr, cptr, 10); ret = memcmp(vram_ptr, cptr, 10);
if (ret) if (ret) {
return ret; ret = -EIO;
goto release_buffer;
}
ret = memcmp(vram_ptr + (size / 2), cptr, 10); ret = memcmp(vram_ptr + (size / 2), cptr, 10);
if (ret) if (ret) {
return ret; ret = -EIO;
goto release_buffer;
}
ret = memcmp(vram_ptr + size - 10, cptr, 10); ret = memcmp(vram_ptr + size - 10, cptr, 10);
if (ret) if (ret) {
return ret; ret = -EIO;
goto release_buffer;
}
release_buffer:
amdgpu_bo_free_kernel(&vram_bo, &vram_gpu, amdgpu_bo_free_kernel(&vram_bo, &vram_gpu,
&vram_ptr); &vram_ptr);
return 0; return ret;
} }
static ssize_t current_memory_partition_show( static ssize_t current_memory_partition_show(