mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-03 12:38:08 +07:00
drm/msm: Gracefully handle failure in _msm_gem_kernel_new
If any of the function calls in _msm_gem_kernel_new fail we need to make sure to dereference the GEM object with the appropriate function for the current locking state. Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
546ec7b471
commit
93f7abf19d
@ -1041,23 +1041,29 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
|
|||||||
|
|
||||||
if (iova) {
|
if (iova) {
|
||||||
ret = msm_gem_get_iova(obj, aspace, iova);
|
ret = msm_gem_get_iova(obj, aspace, iova);
|
||||||
if (ret) {
|
if (ret)
|
||||||
drm_gem_object_put(obj);
|
goto err;
|
||||||
return ERR_PTR(ret);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vaddr = msm_gem_get_vaddr(obj);
|
vaddr = msm_gem_get_vaddr(obj);
|
||||||
if (IS_ERR(vaddr)) {
|
if (IS_ERR(vaddr)) {
|
||||||
msm_gem_put_iova(obj, aspace);
|
msm_gem_put_iova(obj, aspace);
|
||||||
drm_gem_object_put(obj);
|
ret = PTR_ERR(vaddr);
|
||||||
return ERR_CAST(vaddr);
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bo)
|
if (bo)
|
||||||
*bo = obj;
|
*bo = obj;
|
||||||
|
|
||||||
return vaddr;
|
return vaddr;
|
||||||
|
err:
|
||||||
|
if (locked)
|
||||||
|
drm_gem_object_put(obj);
|
||||||
|
else
|
||||||
|
drm_gem_object_put_unlocked(obj);
|
||||||
|
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
|
void *msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
|
||||||
|
Loading…
Reference in New Issue
Block a user