All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org,
	"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>,
	lgirdwood@gmail.com
Subject: [PATCH 4/4] ASoC: Intel: Skylake: Fix DSP core ref count for init failure
Date: Tue, 22 Aug 2017 16:45:53 +0530	[thread overview]
Message-ID: <1503400553-15377-5-git-send-email-subhransu.s.prusty@intel.com> (raw)
In-Reply-To: <1503400553-15377-1-git-send-email-subhransu.s.prusty@intel.com>

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 --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]++;
-
 out:
 	dev_dbg(ctx->dev, "core id %d state %d usage_count %d\n",
 			core_id, skl->cores.state[core_id],
-- 
1.9.1

  parent reply	other threads:[~2017-08-22 11:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 11:15 [PATCH 0/4] ASoC: Intel: Skylake: Fixes to free resources on init failure Subhransu S. Prusty
2017-08-22 11:15 ` [PATCH 1/4] ASoC: Intel: Skylake: Fix to free dsp resource on ipc_init failure Subhransu S. Prusty
2017-08-23 11:24   ` Applied "ASoC: Intel: Skylake: Fix to free dsp resource on ipc_init failure" to the asoc tree Mark Brown
2017-08-22 11:15 ` [PATCH 2/4] ASoC: Intel: Skylake: Fix to free resources for dsp_init failure Subhransu S. Prusty
2017-08-23 11:24   ` Applied "ASoC: Intel: Skylake: Fix to free resources for dsp_init failure" to the asoc tree Mark Brown
2017-08-22 11:15 ` [PATCH 3/4] ASoC: Intel: Skylake: Fix to free correct dev id in free_irq Subhransu S. Prusty
2017-08-23 11:24   ` Applied "ASoC: Intel: Skylake: Fix to free correct dev id in free_irq" to the asoc tree Mark Brown
2017-08-22 11:15 ` Subhransu S. Prusty [this message]
2017-08-23 11:24   ` Applied "ASoC: Intel: Skylake: Fix DSP core ref count for init failure" " Mark Brown
2017-08-23  1:11 ` [PATCH 0/4] ASoC: Intel: Skylake: Fixes to free resources on init failure Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503400553-15377-5-git-send-email-subhransu.s.prusty@intel.com \
    --to=subhransu.s.prusty@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.