aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunjie Mao <junjie.mao@enight.me>2015-07-17 10:29:00 +0800
committerMark Brown <broonie@kernel.org>2015-08-14 17:41:21 +0100
commite1d46d30d133e7909e7dde06a4e867225c7e079b (patch)
tree7eaad75a3764e9b34ea9a97fcb21b2d1f51f9e8f
parentASoC: Intel: Skylake: Add pipe management helpers (diff)
downloadlinux-dev-e1d46d30d133e7909e7dde06a4e867225c7e079b.tar.xz
linux-dev-e1d46d30d133e7909e7dde06a4e867225c7e079b.zip
ASoC: Intel: fix runtime pm imbalance on error
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: Junjie Mao <junjie.mao@enight.me> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/intel/atom/sst/sst_drv_interface.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/intel/atom/sst/sst_drv_interface.c b/sound/soc/intel/atom/sst/sst_drv_interface.c
index 620da1d1b9e3..27a9653aa3d9 100644
--- a/sound/soc/intel/atom/sst/sst_drv_interface.c
+++ b/sound/soc/intel/atom/sst/sst_drv_interface.c
@@ -152,6 +152,7 @@ static int sst_power_control(struct device *dev, bool state)
dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
if (ret < 0) {
+ pm_runtime_put_sync(dev);
dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
return ret;
}
@@ -204,8 +205,10 @@ static int sst_cdev_open(struct device *dev,
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
retval = pm_runtime_get_sync(ctx->dev);
- if (retval < 0)
+ if (retval < 0) {
+ pm_runtime_put_sync(ctx->dev);
return retval;
+ }
str_id = sst_get_stream(ctx, str_params);
if (str_id > 0) {
@@ -672,8 +675,10 @@ static int sst_send_byte_stream(struct device *dev,
if (NULL == bytes)
return -EINVAL;
ret_val = pm_runtime_get_sync(ctx->dev);
- if (ret_val < 0)
+ if (ret_val < 0) {
+ pm_runtime_put_sync(ctx->dev);
return ret_val;
+ }
ret_val = sst_send_byte_stream_mrfld(ctx, bytes);
sst_pm_runtime_put(ctx);