diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2016-08-27 12:30:25 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2016-09-02 10:34:47 -0400 |
commit | dc08267ac4ee7d4b602dd0ac000114e4426e2769 (patch) | |
tree | 91c9196b58c715aa3bc54e0c4eeaed702f5cce34 | |
parent | 5e0b1617fc38a27cf494c5d0b51f08de77ce0d20 (diff) |
drm/amdgpu: handle runtime pm correctly in amdgpu_driver_open_kms
Need to fix the error paths.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index f1b9e0f2869f..cc4ae1103332 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -542,12 +542,16 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
542 | return r; | 542 | return r; |
543 | 543 | ||
544 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); | 544 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
545 | if (unlikely(!fpriv)) | 545 | if (unlikely(!fpriv)) { |
546 | return -ENOMEM; | 546 | r = -ENOMEM; |
547 | goto out_suspend; | ||
548 | } | ||
547 | 549 | ||
548 | r = amdgpu_vm_init(adev, &fpriv->vm); | 550 | r = amdgpu_vm_init(adev, &fpriv->vm); |
549 | if (r) | 551 | if (r) { |
550 | goto error_free; | 552 | kfree(fpriv); |
553 | goto out_suspend; | ||
554 | } | ||
551 | 555 | ||
552 | mutex_init(&fpriv->bo_list_lock); | 556 | mutex_init(&fpriv->bo_list_lock); |
553 | idr_init(&fpriv->bo_list_handles); | 557 | idr_init(&fpriv->bo_list_handles); |
@@ -556,12 +560,9 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv) | |||
556 | 560 | ||
557 | file_priv->driver_priv = fpriv; | 561 | file_priv->driver_priv = fpriv; |
558 | 562 | ||
563 | out_suspend: | ||
559 | pm_runtime_mark_last_busy(dev->dev); | 564 | pm_runtime_mark_last_busy(dev->dev); |
560 | pm_runtime_put_autosuspend(dev->dev); | 565 | pm_runtime_put_autosuspend(dev->dev); |
561 | return 0; | ||
562 | |||
563 | error_free: | ||
564 | kfree(fpriv); | ||
565 | 566 | ||
566 | return r; | 567 | return r; |
567 | } | 568 | } |