From: Eric Anholt Date: Mon, 17 Apr 2017 16:26:03 +0000 (-0700) Subject: drm/vc4: Fix refcounting of runtime PM get if it errors out. X-Git-Tag: v4.13-rc1~73^2~30^2~57 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=925d05e1f825db9490da33afe35bd5383d301e97;p=linux.git 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 Link: http://patchwork.freedesktop.org/patch/msgid/20170417162603.12726-1-eric@anholt.net Reviewed-by: Sean Paul --- diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index a1a01044263c..12fb70ef3170 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -1010,13 +1010,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);