drm/vc4: Fix refcounting of runtime PM get if it errors out.
authorEric Anholt <eric@anholt.net>
Mon, 17 Apr 2017 16:26:03 +0000 (09:26 -0700)
committerRaspbian kernel package updater <root@raspbian.org>
Sun, 8 Oct 2017 01:08:28 +0000 (01:08 +0000)
We were returning without decrementing if the error happened, meaning
that at the next submit we wouldn't try to bring up the power domain.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: http://patchwork.freedesktop.org/patch/msgid/20170417162603.12726-1-eric@anholt.net
Reviewed-by: Sean Paul <seanpaul@chromium.org>
(cherry picked from commit 925d05e1f825db9490da33afe35bd5383d301e97)

drivers/gpu/drm/vc4/vc4_gem.c

index 32e17b384fbc491e204b91f663a8485b6d79e948..994295fe1084371c1169ef313efa58e2a6de30b5 100644 (file)
@@ -876,13 +876,16 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
        }
 
        mutex_lock(&vc4->power_lock);
-       if (vc4->power_refcount++ == 0)
+       if (vc4->power_refcount++ == 0) {
                ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
-       mutex_unlock(&vc4->power_lock);
-       if (ret < 0) {
-               kfree(exec);
-               return ret;
+               if (ret < 0) {
+                       mutex_unlock(&vc4->power_lock);
+                       vc4->power_refcount--;
+                       kfree(exec);
+                       return ret;
+               }
        }
+       mutex_unlock(&vc4->power_lock);
 
        exec->args = args;
        INIT_LIST_HEAD(&exec->unref_list);