Commit e1d46d30 authored by Junjie Mao's avatar Junjie Mao Committed by Mark Brown

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: default avatarJunjie Mao <junjie.mao@enight.me>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c9b1e834
...@@ -152,6 +152,7 @@ static int sst_power_control(struct device *dev, bool state) ...@@ -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); dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
if (ret < 0) { if (ret < 0) {
pm_runtime_put_sync(dev);
dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret); dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
return ret; return ret;
} }
...@@ -204,8 +205,10 @@ static int sst_cdev_open(struct device *dev, ...@@ -204,8 +205,10 @@ static int sst_cdev_open(struct device *dev,
struct intel_sst_drv *ctx = dev_get_drvdata(dev); struct intel_sst_drv *ctx = dev_get_drvdata(dev);
retval = pm_runtime_get_sync(ctx->dev); retval = pm_runtime_get_sync(ctx->dev);
if (retval < 0) if (retval < 0) {
pm_runtime_put_sync(ctx->dev);
return retval; return retval;
}
str_id = sst_get_stream(ctx, str_params); str_id = sst_get_stream(ctx, str_params);
if (str_id > 0) { if (str_id > 0) {
...@@ -672,8 +675,10 @@ static int sst_send_byte_stream(struct device *dev, ...@@ -672,8 +675,10 @@ static int sst_send_byte_stream(struct device *dev,
if (NULL == bytes) if (NULL == bytes)
return -EINVAL; return -EINVAL;
ret_val = pm_runtime_get_sync(ctx->dev); 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; return ret_val;
}
ret_val = sst_send_byte_stream_mrfld(ctx, bytes); ret_val = sst_send_byte_stream_mrfld(ctx, bytes);
sst_pm_runtime_put(ctx); sst_pm_runtime_put(ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment