[PATCH] ASoC: wm8962: Fix runtime PM imbalance on error

From: Dinghao Liu
Date: Tue May 26 2020 - 22:47:24 EST


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@xxxxxxxxxx>
---
sound/soc/codecs/wm8962.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index d9d59f45833f..bb806b195d10 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2881,6 +2881,7 @@ static int wm8962_set_fll(struct snd_soc_component *component, int fll_id, int s

ret = pm_runtime_get_sync(component->dev);
if (ret < 0) {
+ pm_runtime_put_noidle(component->dev);
dev_err(component->dev, "Failed to resume device: %d\n", ret);
return ret;
}
@@ -3013,6 +3014,7 @@ static irqreturn_t wm8962_irq(int irq, void *data)

ret = pm_runtime_get_sync(dev);
if (ret < 0) {
+ pm_runtime_put_noidle(dev);
dev_err(dev, "Failed to resume: %d\n", ret);
return IRQ_NONE;
}
--
2.17.1