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/amdgpu/userq: use pm_runtime_resume_and_get and fix err handling

Use pm_runtime_resume_and_get instead of pm_runtime_get_sync as it
return error but put the reference in the function itself.

In goto statements we need to drop the pm reference too.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@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
d3a9fe45 1e8b7062

+8 -5
+8 -5
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
··· 736 736 if (r) 737 737 return r; 738 738 739 - r = pm_runtime_get_sync(adev_to_drm(adev)->dev); 739 + r = pm_runtime_resume_and_get(adev_to_drm(adev)->dev); 740 740 if (r < 0) { 741 - drm_file_err(uq_mgr->file, "pm_runtime_get_sync() failed for userqueue create\n"); 742 - pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); 741 + drm_file_err(uq_mgr->file, "pm_runtime_resume_and_get() failed for userqueue create\n"); 743 742 return r; 744 743 } 745 744 ··· 746 747 if (!uq_funcs) { 747 748 drm_file_err(uq_mgr->file, "Usermode queue is not supported for this IP (%u)\n", 748 749 args->in.ip_type); 749 - return -EINVAL; 750 + r = -EINVAL; 751 + goto err_pm_runtime; 750 752 } 751 753 752 754 queue = kzalloc_obj(struct amdgpu_usermode_queue); 753 755 if (!queue) { 754 756 drm_file_err(uq_mgr->file, "Failed to allocate memory for queue\n"); 755 - return -ENOMEM; 757 + r = -ENOMEM; 758 + goto err_pm_runtime; 756 759 } 757 760 758 761 INIT_LIST_HEAD(&queue->userq_va_list); ··· 868 867 amdgpu_bo_unreserve(fpriv->vm.root.bo); 869 868 free_queue: 870 869 kfree(queue); 870 + err_pm_runtime: 871 + pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); 871 872 return r; 872 873 } 873 874