alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: keqiao.zhang@intel.com
To: alsa-devel@alsa-project.org
Cc: keqiao.zhang@intel.com
Subject: [PATCH 1/2] alsabat: fix alsabat -86 error
Date: Fri, 26 Aug 2016 23:37:54 +0800	[thread overview]
Message-ID: <1472225875-18081-2-git-send-email-keqiao.zhang@intel.com> (raw)
In-Reply-To: <1472225875-18081-1-git-send-email-keqiao.zhang@intel.com>

From: "Keqiao, Zhang" <keqiao.zhang@intel.com>

alsabat reports -86 error when system suspend and resume. Check the
return value of read_to_pcm() and write_to_pcm(), when -x8 err is
detected, do resume and wait for read/write to pcm to complete.

Write PCM device error: Streams pipe error(-86)
Read PCM device error: Streams pipe error(-86)
*** Error in alsabat: double free or corruption (out): 0x00007fb438001810 ***

Signed-off-by: Keqiao, Zhang <keqiao.zhang@intel.com>
---
 bat/alsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bat/alsa.c b/bat/alsa.c
index cef1734..7613f44 100644
--- a/bat/alsa.c
+++ b/bat/alsa.c
@@ -319,6 +319,11 @@ static int write_to_pcm(const struct pcm_container *sndpcm,
 			if (bat->roundtriplatency)
 				bat->latency.xrun_error = true;
 			snd_pcm_prepare(sndpcm->handle);
+		} else if (err == -ESTRPIPE) {
+			while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN)
+				sleep(1);  /* wait until resume flag is released */
+			if (err < 0)
+				snd_pcm_prepare(sndpcm->handle);
 		} else if (err < 0) {
 			fprintf(bat->err, _("Write PCM device error: %s(%d)\n"),
 					snd_strerror(err), err);
@@ -518,6 +523,11 @@ static int read_from_pcm(struct pcm_container *sndpcm,
 					snd_strerror(err), err);
 			if (bat->roundtriplatency)
 				bat->latency.xrun_error = true;
+		} else if (err == -ESTRPIPE) {
+			while ((err = snd_pcm_resume(sndpcm->handle)) == -EAGAIN)
+				sleep(1);  /* wait until resume flag is released */
+			if (err < 0)
+				snd_pcm_prepare(sndpcm->handle);
 		} else if (err < 0) {
 			fprintf(bat->err, _("Read PCM device error: %s(%d)\n"),
 					snd_strerror(err), err);
-- 
2.5.0

  reply	other threads:[~2016-08-26  7:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26 15:37 [PATCH 0/2] alsabat: add power management S3 test keqiao.zhang
2016-08-26 15:37 ` keqiao.zhang [this message]
2016-08-26 15:37 ` [PATCH 2/2] alsabat: add system " keqiao.zhang
2016-08-30  5:50 ` [PATCH 0/2] alsabat: add " Takashi Iwai

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=1472225875-18081-2-git-send-email-keqiao.zhang@intel.com \
    --to=keqiao.zhang@intel.com \
    --cc=alsa-devel@alsa-project.org \
    /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).