Re: [PATCH 4/5] ALSA: usb-audio: deallocate memory objects in error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 22 Feb 2017 14:37:22 +0100,
Takashi Sakamoto wrote:
> 
> On Feb 22 2017 16:46, Takashi Iwai wrote:
> > -- 8< --
> > From: Takashi Iwai <tiwai@xxxxxxx>
> > Subject: [PATCH] ALSA: usb-audio: Tidy up mixer_us16x08.c
> >
> > A few more cleanups and improvements that have been overlooked:
> >
> > - Use ARRAY_SIZE() macro appropriately
> > - Code shuffling for minor optimization
> > - Omit superfluous variable initializations
> > - Get rid of superfluous NULL checks
> > - Add const to snd_us16x08_control_params definitions
> >
> > No functional changes.
> >
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> > ---
> >  sound/usb/mixer_us16x08.c | 132 ++++++++++++++++++----------------------------
> >  1 file changed, 50 insertions(+), 82 deletions(-)
> 
> Looks good to me, except for one item.
> 
> Reviewed-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
> 
> > diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c
> > index f7289541fbce..dc48eedea92e 100644
> > --- a/sound/usb/mixer_us16x08.c
> > +++ b/sound/usb/mixer_us16x08.c
> > @@ -176,15 +176,9 @@ static int snd_us16x08_recv_urb(struct snd_usb_audio *chip,
> >   */
> >  static int snd_us16x08_send_urb(struct snd_usb_audio *chip, char *buf, int size)
> >  {
> > -	int err = 0;
> > -
> > -	if (chip) {
> > -		err = snd_usb_ctl_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0),
> > +	return snd_usb_ctl_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0),
> >  			SND_US16X08_URB_REQUEST, SND_US16X08_URB_REQUESTTYPE,
> >  			0, 0, buf, size);
> > -	}
> > -
> > -	return err;
> >  }
> 
> Inline function is better for this part because the definition
> includes a few statements.

Basically you don't need to mark inline unless you really have to do
it explicitly.  Compiler is smart enough, often smarter than us.


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux