All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lu, Han" <han.lu@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "liam.r.girdwood@linux.intel.com"
	<liam.r.girdwood@linux.intel.com>,
	"Gautier, Bernard" <bernard.gautier@intel.com>,
	"Popescu, Edward C" <edward.c.popescu@intel.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [PATCH 09/10] alsabat: use variable for thread return	value
Date: Mon, 14 Mar 2016 09:36:53 +0000	[thread overview]
Message-ID: <B51200AC81AB024499A3C2C9A1BB90A83D3AAC70@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <s5hy49l4dq8.wl-tiwai@suse.de>

Hi Takashi,

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de]
> Sent: Monday, March 14, 2016 5:21 PM
> To: Lu, Han <han.lu@intel.com>
> Cc: liam.r.girdwood@linux.intel.com; Gautier, Bernard
> <bernard.gautier@intel.com>; Popescu, Edward C
> <edward.c.popescu@intel.com>; alsa-devel@alsa-project.org
> Subject: Re: [alsa-devel] [PATCH 09/10] alsabat: use variable for thread
> return value
> 
> On Mon, 14 Mar 2016 10:15:20 +0100,
> Lu, Han wrote:
> >
> > Hi Takashi,
> >
> > > -----Original Message-----
> > > From: Takashi Iwai [mailto:tiwai@suse.de]
> > > Sent: Friday, March 11, 2016 9:34 PM
> > > To: Lu, Han <han.lu@intel.com>
> > > Cc: liam.r.girdwood@linux.intel.com; Gautier, Bernard
> > > <bernard.gautier@intel.com>; Popescu, Edward C
> > > <edward.c.popescu@intel.com>; alsa-devel@alsa-project.org
> > > Subject: Re: [alsa-devel] [PATCH 09/10] alsabat: use variable for
> > > thread return value
> > >
> > > On Wed, 02 Mar 2016 09:53:19 +0100,
> > > han.lu@intel.com wrote:
> > > >
> > > > From: "Lu, Han" <han.lu@intel.com>
> > > >
> > > > Replace fixed "1" to variable for thread return value.
> > > >
> > > > Signed-off-by: Lu, Han <han.lu@intel.com>
> > > >
> > > > diff --git a/bat/alsa.c b/bat/alsa.c index 0a5f899..189b0e9 100644
> > > > --- a/bat/alsa.c
> > > > +++ b/bat/alsa.c
> > > > @@ -309,13 +309,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;
> > > >  	}
> > > >
> > > > @@ -332,13 +332,13 @@ void *playback_alsa(struct bat *bat)
> > > >  			fprintf(bat->err, _("Cannot open file for playback: "));
> > > >  			fprintf(bat->err, _("%s %d\n"),
> > > >  					bat->playback.file, -errno);
> > > > -			retval_play = 1;
> > > > +			retval_play = -errno;
> > >
> > > Is the original errno still preserved at this point...?
> >
> > [han] I think so, the complete code section here is
> > 	...
> > 	bat->fp = fopen(bat->playback.file, "rb");
> > 	if (bat->fp == NULL) {
> > 		fprintf(bat->err, _("Cannot open file for playback: "));
> > 		fprintf(bat->err, _("%s %d\n"),
> > 				bat->playback.file, -errno);
> > -		retval_play = 1;
> > +		retval_play = -errno;
> > 		goto exit3;
> > 	}
> > 	...
> > So the use of errno should be safe.
> 
> You call a bunch of functions between the fopen() error and the reference of
> errno.  The errno reference should be done immediately after the error.
> 
> 
> Takashi

[han] sorry! I ignored the errno could be changed by the printf(). I'll rewrite the
patch and fix other similar errors.

BR,
Han

  reply	other threads:[~2016-03-14  9:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02  8:53 [PATCH 00/10] *** alsabat features and fixes *** han.lu
2016-03-02  8:53 ` [PATCH 01/10] alsabat: add default device name for playback and capture han.lu
2016-03-04 20:57   ` Takashi Iwai
2016-03-07  1:24     ` Lu, Han
2016-03-08 10:15       ` Takashi Iwai
2016-03-02  8:53 ` [PATCH 02/10] alsabat: add standalone mode han.lu
2016-03-08 10:18   ` Takashi Iwai
2016-03-15  3:45     ` Lu, Han
2016-03-02  8:53 ` [PATCH 03/10] alsabat: add tinyalsa support han.lu
2016-03-11 14:13   ` Takashi Iwai
2016-03-15  3:50     ` Lu, Han
2016-03-02  8:53 ` [PATCH 04/10] alsabat: clean the thread loopback of alsa capture han.lu
2016-03-02  8:53 ` [PATCH 05/10] alsabat: refactor wav file process han.lu
2016-03-02  8:53 ` [PATCH 06/10] alsabat: use common data generator function han.lu
2016-03-02  8:53 ` [PATCH 07/10] alsabat: add interrupt handler for shutdown han.lu
2016-03-02  8:53 ` [PATCH 08/10] alsabat: fix an incorrect print han.lu
2016-03-02  8:53 ` [PATCH 09/10] alsabat: use variable for thread return value han.lu
2016-03-11 13:34   ` Takashi Iwai
2016-03-14  9:15     ` Lu, Han
2016-03-14  9:21       ` Takashi Iwai
2016-03-14  9:36         ` Lu, Han [this message]
2016-03-14  9:43           ` Takashi Iwai
2016-03-14  9:53             ` Lu, Han
2016-03-02  8:53 ` [PATCH 10/10] alsabat: add bash test script han.lu
2016-03-04 20:58   ` 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=B51200AC81AB024499A3C2C9A1BB90A83D3AAC70@SHSMSX101.ccr.corp.intel.com \
    --to=han.lu@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bernard.gautier@intel.com \
    --cc=edward.c.popescu@intel.com \
    --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 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.