From: han.lu@intel.com
To: tiwai@suse.de, liam.r.girdwood@linux.intel.com,
alsa-devel@alsa-project.org
Cc: "Lu, Han" <han.lu@intel.com>
Subject: [PATCH 3/3] alsabat: use variable for thread return value
Date: Mon, 21 Mar 2016 19:05:49 +0800 [thread overview]
Message-ID: <441bb3b26f4546909d4583fdfaa468df8c3db3bd.1458558001.git.han.lu@intel.com> (raw)
In-Reply-To: <cover.1458558001.git.han.lu@intel.com>
In-Reply-To: <cover.1458558001.git.han.lu@intel.com>
From: "Lu, Han" <han.lu@intel.com>
Use variable instead of 0/1 to indicate the return value of
playback and capture threads.
Signed-off-by: Lu, Han <han.lu@intel.com>
diff --git a/bat/alsa.c b/bat/alsa.c
index 2540ab8..79c86fe 100644
--- a/bat/alsa.c
+++ b/bat/alsa.c
@@ -383,13 +383,13 @@ void *playback_alsa(struct bat *bat)
if (err != 0) {
fprintf(bat->err, _("Cannot open PCM playback device: "));
fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err);
- retval_play = 1;
+ retval_play = err;
goto exit1;
}
err = set_snd_pcm_params(bat, &sndpcm);
if (err != 0) {
- retval_play = 1;
+ retval_play = err;
goto exit2;
}
@@ -406,20 +406,20 @@ void *playback_alsa(struct bat *bat)
if (bat->fp == NULL) {
fprintf(bat->err, _("Cannot open file: %s %d\n"),
bat->playback.file, err);
- retval_play = 1;
+ retval_play = err;
goto exit3;
}
/* Skip header */
err = read_wav_header(bat, bat->playback.file, bat->fp, true);
if (err != 0) {
- retval_play = 1;
+ retval_play = err;
goto exit4;
}
}
err = write_to_pcm_loop(&sndpcm, bat);
if (err != 0) {
- retval_play = 1;
+ retval_play = err;
goto exit4;
}
@@ -533,13 +533,13 @@ void *record_alsa(struct bat *bat)
if (err != 0) {
fprintf(bat->err, _("Cannot open PCM capture device: "));
fprintf(bat->err, _("%s(%d)\n"), snd_strerror(err), err);
- retval_record = 1;
+ retval_record = err;
goto exit1;
}
err = set_snd_pcm_params(bat, &sndpcm);
if (err != 0) {
- retval_record = 1;
+ retval_record = err;
goto exit2;
}
@@ -549,7 +549,7 @@ void *record_alsa(struct bat *bat)
if (fp == NULL) {
fprintf(bat->err, _("Cannot open file: %s %d\n"),
bat->capture.file, err);
- retval_record = 1;
+ retval_record = err;
goto exit3;
}
@@ -563,7 +563,7 @@ void *record_alsa(struct bat *bat)
err = write_wav_header(fp, &wav, bat);
if (err != 0) {
- retval_record = 1;
+ retval_record = err;
goto exit4;
}
@@ -571,7 +571,7 @@ void *record_alsa(struct bat *bat)
fprintf(bat->log, _("Recording ...\n"));
err = read_from_pcm_loop(fp, count, &sndpcm, bat);
if (err != 0) {
- retval_record = 1;
+ retval_record = err;
goto exit4;
}
--
2.5.0
next prev parent reply other threads:[~2016-03-21 11:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 11:05 [PATCH 0/3] *** Some trival fixes on alsabat *** han.lu
2016-03-21 11:05 ` [PATCH 1/3] alsabat: fix misusing of errno han.lu
2016-03-21 11:05 ` [PATCH 2/3] alsabat: fix fopen and messages han.lu
2016-03-21 11:05 ` han.lu [this message]
2016-03-21 17:06 ` [PATCH 0/3] *** Some trival fixes on alsabat *** 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=441bb3b26f4546909d4583fdfaa468df8c3db3bd.1458558001.git.han.lu@intel.com \
--to=han.lu@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=liam.r.girdwood@linux.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 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).