]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/nouveau: fix runtime pm imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Wed, 20 May 2020 10:25:49 +0000 (18:25 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 1 Oct 2020 11:14:45 +0000 (13:14 +0200)
[ Upstream commit d7372dfb3f7f1602b87e0663e8b8646da23ebca7 ]

pm_runtime_get_sync() increments the runtime PM usage counter even
the call returns an error code. Thus a pairing decrement is needed
on the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/nouveau/nouveau_gem.c

index 791f970714ed65e28520d33ecb955aeab5727556..a98fccb0d32f9ea9d396a9ef0e21b04d70e6f25f 100644 (file)
@@ -82,8 +82,10 @@ nouveau_gem_object_open(struct drm_gem_object *gem, struct drm_file *file_priv)
                return ret;
 
        ret = pm_runtime_get_sync(dev);
-       if (ret < 0 && ret != -EACCES)
+       if (ret < 0 && ret != -EACCES) {
+               pm_runtime_put_autosuspend(dev);
                goto out;
+       }
 
        ret = nouveau_vma_new(nvbo, &cli->vmm, &vma);
        pm_runtime_mark_last_busy(dev);