Commit 32c59dc1 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: handle runtime pm correctly in amdgpu_driver_open_kms

Need to fix the error paths.
Reviewed-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent dc08267a
...@@ -641,11 +641,11 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) ...@@ -641,11 +641,11 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
if (rdev->family >= CHIP_CAYMAN) { if (rdev->family >= CHIP_CAYMAN) {
struct radeon_fpriv *fpriv; struct radeon_fpriv *fpriv;
struct radeon_vm *vm; struct radeon_vm *vm;
int r;
fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
if (unlikely(!fpriv)) { if (unlikely(!fpriv)) {
return -ENOMEM; r = -ENOMEM;
goto out_suspend;
} }
if (rdev->accel_working) { if (rdev->accel_working) {
...@@ -653,14 +653,14 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) ...@@ -653,14 +653,14 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
r = radeon_vm_init(rdev, vm); r = radeon_vm_init(rdev, vm);
if (r) { if (r) {
kfree(fpriv); kfree(fpriv);
return r; goto out_suspend;
} }
r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false);
if (r) { if (r) {
radeon_vm_fini(rdev, vm); radeon_vm_fini(rdev, vm);
kfree(fpriv); kfree(fpriv);
return r; goto out_suspend;
} }
/* map the ib pool buffer read only into /* map the ib pool buffer read only into
...@@ -674,15 +674,16 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) ...@@ -674,15 +674,16 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
if (r) { if (r) {
radeon_vm_fini(rdev, vm); radeon_vm_fini(rdev, vm);
kfree(fpriv); kfree(fpriv);
return r; goto out_suspend;
} }
} }
file_priv->driver_priv = fpriv; file_priv->driver_priv = fpriv;
} }
out_suspend:
pm_runtime_mark_last_busy(dev->dev); pm_runtime_mark_last_busy(dev->dev);
pm_runtime_put_autosuspend(dev->dev); pm_runtime_put_autosuspend(dev->dev);
return 0; return r;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment