On 2025-10-24 15:07, Sunil Khatri wrote:
we need to unreserve the bo's too during clean up along
with freeing the memory of context.
Fixes: c549912cd8 (drm/amdkfd: add missing return value check for range)
Signed-off-by: Sunil Khatri <[email protected]>
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index 7f0ab73e2396..35c592024a01 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -1738,14 +1738,12 @@ static int svm_range_validate_and_map(struct mm_struct
*mm,
WRITE_ONCE(p->svms.faulting_task, current);
range = amdgpu_hmm_range_alloc(NULL);
- if (unlikely(!range)) {
- r = -ENOMEM;
- goto free_ctx;
- }
-
- r = amdgpu_hmm_range_get_pages(&prange->notifier, addr,
npages,
+ if (likely(range))
+ r =
amdgpu_hmm_range_get_pages(&prange->notifier, addr, npages,
readonly, owner,
range);
Please fix the indentation here so the parameters line up with the open
parenthesis. With that fixed, the patch is
Reviewed-by: Felix Kuehling <[email protected]>
+ else
+ r = -ENOMEM;
WRITE_ONCE(p->svms.faulting_task, NULL);
if (r) {
amdgpu_hmm_range_free(range);