]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: caller should make sure not to double free
authorSunil Khatri <sunil.khatri@amd.com>
Tue, 28 Oct 2025 12:09:27 +0000 (17:39 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 4 Nov 2025 16:33:53 +0000 (11:33 -0500)
Remove the NULL check from amdgpu_hmm_range_free for hmm_pfns
as caller is responsible not to call amdgpu_hmm_range_free
more than once.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c

index 518ca3f4db2bc16d3f3f6dd43d2165ffdb7c13c7..90d26d820bac0d9a6e19734e3b7f33d21f284cce 100644 (file)
@@ -287,9 +287,7 @@ void amdgpu_hmm_range_free(struct amdgpu_hmm_range *range)
        if (!range)
                return;
 
-       if (range->hmm_range.hmm_pfns)
-               kvfree(range->hmm_range.hmm_pfns);
-
+       kvfree(range->hmm_range.hmm_pfns);
        amdgpu_bo_unref(&range->bo);
        kfree(range);
 }