disp: msm: use pm_runtime_resume_and_get instead of pm_runtime_get_sync

pm_runtime_get_sync increases the usage_count refcount immaterial of
success/failure of the call, leading to invalid refcount on failures.
Use pm_runtime_resume_and_get instead, which takes care of reducing the
refcount on failure cases before returning from the function.

Change-Id: Ib96050d5d7ecbd717e58b8a0dde2d03312444e15
Signed-off-by: Veera Sundaram Sankaran <quic_veeras@quicinc.com>
This commit is contained in:
Veera Sundaram Sankaran
2021-12-14 11:26:15 -08:00
rodzic e7c09f0092
commit 56862f8118
11 zmienionych plików z 75 dodań i 46 usunięć

Wyświetl plik

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Copyright (C) 2013 Red Hat
* Author: Rob Clark <robdclark@gmail.com>
@@ -1708,7 +1708,7 @@ static int _sde_encoder_resource_control_helper(struct drm_encoder *drm_enc,
if (enable) {
/* enable SDE core clks */
rc = pm_runtime_get_sync(drm_enc->dev->dev);
rc = pm_runtime_resume_and_get(drm_enc->dev->dev);
if (rc < 0) {
SDE_ERROR("failed to enable power resource %d\n", rc);
SDE_EVT32(rc, SDE_EVTLOG_ERROR);
@@ -4785,9 +4785,12 @@ static ssize_t _sde_encoder_misr_read(struct file *file,
}
drm_enc = &sde_enc->base;
rc = pm_runtime_get_sync(drm_enc->dev->dev);
if (rc < 0)
rc = pm_runtime_resume_and_get(drm_enc->dev->dev);
if (rc < 0) {
SDE_ERROR("failed to enable power resource %d\n", rc);
SDE_EVT32(rc, SDE_EVTLOG_ERROR);
return rc;
}
sde_vm_lock(sde_kms);
if (!sde_vm_owns_hw(sde_kms)) {