devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olivier Moysan <olivier.moysan@st.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, mcoquelin.stm32@gmail.com,
	alexandre.torgue@st.com, alsa-devel@alsa-project.org,
	robh@kernel.org, mark.rutland@arm.com,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kernel@stlinux.com, linux-kernel@vger.kernel.org,
	olivier.moysan@st.com
Cc: arnaud.pouliquen@st.com, benjamin.gaignard@st.com
Subject: [INTERNAL][PATCH 4/7] ASoC: stm32: sai: fix stop management in isr
Date: Thu, 19 Oct 2017 15:03:20 +0200	[thread overview]
Message-ID: <1508418203-16840-5-git-send-email-olivier.moysan@st.com> (raw)
In-Reply-To: <1508418203-16840-1-git-send-email-olivier.moysan@st.com>

Add check on substream validity.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
---
 sound/soc/stm/stm32_sai_sub.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index 2af397d..815ef10 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -184,7 +184,6 @@ static bool stm32_sai_sub_writeable_reg(struct device *dev, unsigned int reg)
 static irqreturn_t stm32_sai_isr(int irq, void *devid)
 {
 	struct stm32_sai_sub_data *sai = (struct stm32_sai_sub_data *)devid;
-	struct snd_pcm_substream *substream = sai->substream;
 	struct platform_device *pdev = sai->pdev;
 	unsigned int sr, imr, flags;
 	snd_pcm_state_t status = SNDRV_PCM_STATE_RUNNING;
@@ -199,6 +198,11 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid)
 	regmap_update_bits(sai->regmap, STM_SAI_CLRFR_REGX, SAI_XCLRFR_MASK,
 			   SAI_XCLRFR_MASK);
 
+	if (!sai->substream) {
+		dev_err(&pdev->dev, "Device stopped. Spurious IRQ 0x%x\n", sr);
+		return IRQ_NONE;
+	}
+
 	if (flags & SAI_XIMR_OVRUDRIE) {
 		dev_err(&pdev->dev, "IRQ %s\n",
 			STM_SAI_IS_PLAYBACK(sai) ? "underrun" : "overrun");
@@ -227,9 +231,9 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid)
 	}
 
 	if (status != SNDRV_PCM_STATE_RUNNING) {
-		snd_pcm_stream_lock(substream);
-		snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
-		snd_pcm_stream_unlock(substream);
+		snd_pcm_stream_lock(sai->substream);
+		snd_pcm_stop(sai->substream, SNDRV_PCM_STATE_XRUN);
+		snd_pcm_stream_unlock(sai->substream);
 	}
 
 	return IRQ_HANDLED;
-- 
1.9.1

  parent reply	other threads:[~2017-10-19 13:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 13:03 [INTERNAL][PATCH 0/7] ASoC: stm32: Add SAI synchronization support Olivier Moysan
2017-10-19 13:03 ` [INTERNAL][PATCH 1/7] ASoC: stm32: Add synchronization to SAI bindings Olivier Moysan
2017-10-21 10:31   ` Applied "ASoC: stm32: Add synchronization to SAI bindings" to the asoc tree Mark Brown
2017-10-19 13:03 ` [INTERNAL][PATCH 2/7] ASoC: stm32: sai: Move static settings to DAI init Olivier Moysan
2017-10-19 13:03 ` [INTERNAL][PATCH 3/7] ASoC: stm32: sai: Fix DMA burst size Olivier Moysan
2017-10-19 13:03 ` Olivier Moysan [this message]
2017-10-21 10:16   ` [INTERNAL][PATCH 4/7] ASoC: stm32: sai: fix stop management in isr Mark Brown
2017-10-21 10:32   ` Applied "ASoC: stm32: sai: fix stop management in isr" to the asoc tree Mark Brown
2017-10-26 15:32   ` [INTERNAL][PATCH 4/7] ASoC: stm32: sai: fix stop management in isr Takashi Iwai
2017-11-02 16:38     ` Olivier MOYSAN
2017-10-19 13:03 ` [INTERNAL][PATCH 5/7] ASoC: stm32: sai: Remove spurious IRQs on stop Olivier Moysan
2017-10-21 10:31   ` Applied "ASoC: stm32: sai: Remove spurious IRQs on stop" to the asoc tree Mark Brown
2017-10-19 13:03 ` [INTERNAL][PATCH 6/7] ASoC: stm32: sai: Fix get reset controller Olivier Moysan
2017-10-21 10:32   ` Applied "ASoC: stm32: sai: Fix get reset controller" to the asoc tree Mark Brown
2017-10-19 13:03 ` [INTERNAL][PATCH 7/7] ASoC: stm32: sai: Add synchronization support Olivier Moysan
2017-10-21 10:31   ` Applied "ASoC: stm32: sai: Add synchronization support" to the asoc tree Mark Brown
2017-10-19 13:27 ` [INTERNAL][PATCH 0/7] ASoC: stm32: Add SAI synchronization support Olivier MOYSAN

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=1508418203-16840-5-git-send-email-olivier.moysan@st.com \
    --to=olivier.moysan@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=benjamin.gaignard@st.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@stlinux.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=perex@perex.cz \
    --cc=robh@kernel.org \
    --cc=tiwai@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).