Skip to content

Commit fac4ebd

Browse files
srishanmalexdeucher
authored andcommitted
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]>
1 parent 30d8dff commit fac4ebd

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,21 +1045,28 @@ int amdgpu_gmc_vram_checking(struct amdgpu_device *adev)
10451045
* seconds, so here, we just pick up three parts for emulation.
10461046
*/
10471047
ret = memcmp(vram_ptr, cptr, 10);
1048-
if (ret)
1049-
return ret;
1048+
if (ret) {
1049+
ret = -EIO;
1050+
goto release_buffer;
1051+
}
10501052

10511053
ret = memcmp(vram_ptr + (size / 2), cptr, 10);
1052-
if (ret)
1053-
return ret;
1054+
if (ret) {
1055+
ret = -EIO;
1056+
goto release_buffer;
1057+
}
10541058

10551059
ret = memcmp(vram_ptr + size - 10, cptr, 10);
1056-
if (ret)
1057-
return ret;
1060+
if (ret) {
1061+
ret = -EIO;
1062+
goto release_buffer;
1063+
}
10581064

1065+
release_buffer:
10591066
amdgpu_bo_free_kernel(&vram_bo, &vram_gpu,
10601067
&vram_ptr);
10611068

1062-
return 0;
1069+
return ret;
10631070
}
10641071

10651072
static ssize_t current_memory_partition_show(

0 commit comments

Comments
 (0)