diff mbox

[4/4] ASoC: Intel: Skylake: Fix DSP core ref count for init failure

Message ID 1503400553-15377-5-git-send-email-subhransu.s.prusty@intel.com (mailing list archive)
State Accepted
Commit 7b992c24de78a206b3abd07192686d2d5db5012c
Headers show

Commit Message

Subhransu S. Prusty Aug. 22, 2017, 11:15 a.m. UTC
During dsp init failure, the ref count is not incremented and dsp is
powered down. But as the skl driver calls put_core for the init failure it
decrements the dsp core ref count and ref count becomes unbalanced.

This results in dsp core powered up in further runtime suspend/resume
cycles and never powered down.

So increment the ref count before dsp core powerup and for any failure,
decrement in put_core will be balanced.

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
 sound/soc/intel/skylake/skl-sst-dsp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox


diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index c2ba5ff1632c..19ee1d4f3bdf 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -351,6 +351,8 @@  int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id)
 		return -EINVAL;
+	skl->cores.usage_count[core_id]++;
 	if (skl->cores.state[core_id] == SKL_DSP_RESET) {
 		ret = ctx->fw_ops.set_state_D0(ctx, core_id);
 		if (ret < 0) {
@@ -359,8 +361,6 @@  int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id)
-	skl->cores.usage_count[core_id]++;
 	dev_dbg(ctx->dev, "core id %d state %d usage_count %d\n",
 			core_id, skl->cores.state[core_id],