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>
else
r = -ENOMEM;
WRITE_ONCE(p->svms.faulting_task, NULL);
- if (r) {
- amdgpu_hmm_range_free(range);
- range = NULL;
+ if (r)
pr_debug("failed %d to get svm range pages\n", r);
- }
} else {
r = -EFAULT;
}
pr_debug("hmm update the range, need validate again\n");
r = -EAGAIN;
}
- /* Free the hmm range */
- if (range)
- amdgpu_hmm_range_free(range);
+ /* Free the hmm range */
+ amdgpu_hmm_range_free(range);
if (!r && !list_empty(&prange->child_list)) {
pr_debug("range split by unmap in parallel, validate again\n");