From: jsg Date: Tue, 6 Feb 2024 03:58:02 +0000 (+0000) Subject: drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()' X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7c4aa79797519092bf61f010858af1e29740a2e4;p=openbsd drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()' From Srinivasan Shanmugam b02831b8a5b687138df4662ff914aa3defc2499e in linux-6.6.y/6.6.16 fac4ebd79fed60e79cccafdad45a2bb8d3795044 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c index ad76a758ff2..4b975ec9a87 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_gmc.c @@ -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(