From caf33622234ccefda8b8ea303844e3a5e6c65cb7 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 29 Jan 2024 01:56:26 +0000 Subject: [PATCH] drm/amdkfd: fixes for HMM mem allocation From Dafna Hirschfeld 1515db19c4a374f75e6bf5430f9cb9b7e3c2fd0d in linux-6.6.y/6.6.14 02eed83abc1395a1207591aafad9bcfc5cb1abcb in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_migrate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_migrate.c b/sys/dev/pci/drm/amd/amdkfd/kfd_migrate.c index 7d82c7da223..659313648b2 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_migrate.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_migrate.c @@ -1021,7 +1021,7 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev) } else { res = devm_request_free_mem_region(adev->dev, &iomem_resource, size); if (IS_ERR(res)) - return -ENOMEM; + return PTR_ERR(res); pgmap->range.start = res->start; pgmap->range.end = res->end; pgmap->type = MEMORY_DEVICE_PRIVATE; @@ -1037,10 +1037,10 @@ int kgd2kfd_init_zone_device(struct amdgpu_device *adev) r = devm_memremap_pages(adev->dev, pgmap); if (IS_ERR(r)) { pr_err("failed to register HMM device memory\n"); - /* Disable SVM support capability */ - pgmap->type = 0; if (pgmap->type == MEMORY_DEVICE_PRIVATE) devm_release_mem_region(adev->dev, res->start, resource_size(res)); + /* Disable SVM support capability */ + pgmap->type = 0; return PTR_ERR(r); } -- 2.20.1