nouveau_connector_detect() calls pm_runtime_get_sync and in turn
increments the reference count. In case of failure, decrement the
ref count before returning the error.

Signed-off-by: Aditya Pakki <pakki...@umn.edu>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c 
b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 1b383ae0248f..ef8ddbe44581 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -572,8 +572,10 @@ nouveau_connector_detect(struct drm_connector *connector, 
bool force)
                pm_runtime_get_noresume(dev->dev);
        } else {
                ret = pm_runtime_get_sync(dev->dev);
-               if (ret < 0 && ret != -EACCES)
+               if (ret < 0 && ret != -EACCES) {
+                       pm_runtime_put_autosuspend(dev->dev);
                        return conn_status;
+               }
        }
 
        nv_encoder = nouveau_connector_ddc_detect(connector);
-- 
2.25.1

Reply via email to