Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdkfd: clean up the code to free hmm_range

a. hmm_range is either NULL or a valid pointer so we
do not need to set range to NULL ever.

b. keep the hmm_range_free in the end irrespective of
the other conditions to avoid some additional checks
and also avoid double free issue.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Sunil Khatri and committed by
Alex Deucher
c0de5529 f67d54e9

+3 -7
+3 -7
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 1744 1744 else 1745 1745 r = -ENOMEM; 1746 1746 WRITE_ONCE(p->svms.faulting_task, NULL); 1747 - if (r) { 1748 - amdgpu_hmm_range_free(range); 1749 - range = NULL; 1747 + if (r) 1750 1748 pr_debug("failed %d to get svm range pages\n", r); 1751 - } 1752 1749 } else { 1753 1750 r = -EFAULT; 1754 1751 } ··· 1768 1771 pr_debug("hmm update the range, need validate again\n"); 1769 1772 r = -EAGAIN; 1770 1773 } 1771 - /* Free the hmm range */ 1772 - if (range) 1773 - amdgpu_hmm_range_free(range); 1774 1774 1775 + /* Free the hmm range */ 1776 + amdgpu_hmm_range_free(range); 1775 1777 1776 1778 if (!r && !list_empty(&prange->child_list)) { 1777 1779 pr_debug("range split by unmap in parallel, validate again\n");