gb_pm_runtime_get_sync has increased the usage counter of the device here.
Forgetting to call gb_pm_runtime_put_noidle will result in usage counter
leak in the error branch of (gbcodec_hw_params and gbcodec_prepare). We
fixed it by adding it.

Fixes: c388ae7696992 ("greybus: audio: Update pm runtime support in dai_ops 
callback")
Signed-off-by: Zhang Qilong <zhangqilo...@huawei.com>
---
 drivers/staging/greybus/audio_codec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/greybus/audio_codec.c 
b/drivers/staging/greybus/audio_codec.c
index 17a39ed63769..b589cf6b1d03 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -471,6 +471,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream 
*substream,
        if (ret) {
                dev_err_ratelimited(dai->dev, "%d: Error during set_config\n",
                                    ret);
+               gb_pm_runtime_put_noidle(bundle);
                mutex_unlock(&codec->lock);
                return ret;
        }
@@ -545,6 +546,7 @@ static int gbcodec_prepare(struct snd_pcm_substream 
*substream,
                break;
        }
        if (ret) {
+               gb_pm_runtime_put_noidle(bundle);
                mutex_unlock(&codec->lock);
                dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n", ret);
                return ret;
-- 
2.25.4

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to