drm/vc4: Fix refcounting of runtime PM get if it errors out.

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>
This commit is contained in:
Eric Anholt 2017-04-17 09:26:03 -07:00
parent 4f6e3d66ac
commit 925d05e1f8

View file

@ -1010,13 +1010,16 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
} }
mutex_lock(&vc4->power_lock); mutex_lock(&vc4->power_lock);
if (vc4->power_refcount++ == 0) if (vc4->power_refcount++ == 0) {
ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev);
mutex_unlock(&vc4->power_lock); if (ret < 0) {
if (ret < 0) { mutex_unlock(&vc4->power_lock);
kfree(exec); vc4->power_refcount--;
return ret; kfree(exec);
return ret;
}
} }
mutex_unlock(&vc4->power_lock);
exec->args = args; exec->args = args;
INIT_LIST_HEAD(&exec->unref_list); INIT_LIST_HEAD(&exec->unref_list);