All of lore.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: tiwai@suse.com, broonie@kernel.org
Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org,
	patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com
Subject: [PATCH 3/3] ASoC: wm_adsp: Treat missing compressed buffer as a fatal error
Date: Mon, 13 Jun 2016 14:17:12 +0100	[thread overview]
Message-ID: <1465823832-14718-4-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1465823832-14718-1-git-send-email-ckeepax@opensource.wolfsonmicro.com>

If the DSP is powered down whilst a compressed stream is being processed
we should treat this as a fatal error, clearly the stream is no longer
valid.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 sound/soc/codecs/wm_adsp.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 8ed1cde..7e42474 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -3037,12 +3037,7 @@ int wm_adsp_compr_pointer(struct snd_compr_stream *stream,
 
 	buf = compr->buf;
 
-	if (!compr->buf) {
-		ret = -ENXIO;
-		goto out;
-	}
-
-	if (compr->buf->error) {
+	if (!compr->buf || compr->buf->error) {
 		snd_compr_stop_error(stream, SNDRV_PCM_STATE_XRUN);
 		ret = -EIO;
 		goto out;
@@ -3161,10 +3156,7 @@ static int wm_adsp_compr_read(struct wm_adsp_compr *compr,
 
 	adsp_dbg(dsp, "Requested read of %zu bytes\n", count);
 
-	if (!compr->buf)
-		return -ENXIO;
-
-	if (compr->buf->error) {
+	if (!compr->buf || compr->buf->error) {
 		snd_compr_stop_error(compr->stream, SNDRV_PCM_STATE_XRUN);
 		return -EIO;
 	}
-- 
2.1.4

  parent reply	other threads:[~2016-06-13 13:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 13:17 [PATCH v7 0/3] Propagate errors out from compressed streams Charles Keepax
2016-06-13 13:17 ` [PATCH v7 1/3] ALSA: compress: Add function to indicate the stream has gone bad Charles Keepax
2016-06-13 15:47   ` Applied "ALSA: compress: Add function to indicate the stream has gone bad" to the asoc tree Mark Brown
2016-06-13 13:17 ` [PATCH v7 2/3] ASoC: wm_adsp: Use new snd_compr_stop_error to signal stream failure Charles Keepax
2016-06-13 13:17 ` Charles Keepax [this message]
2016-06-13 15:50   ` Applied "ASoC: wm_adsp: Treat missing compressed buffer as a fatal error" to the asoc tree Mark Brown

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=1465823832-14718-4-git-send-email-ckeepax@opensource.wolfsonmicro.com \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=tiwai@suse.com \
    --cc=vinod.koul@intel.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 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.