lkml.org 
[lkml]   [2016]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.5 072/238] ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()
    Date
    4.5-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Takashi Iwai <tiwai@suse.de>

    commit 902eb7fd1e4af3ac69b9b30f8373f118c92b9729 upstream.

    Just a minor code cleanup: unify the error paths.

    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    sound/usb/quirks.c | 22 +++++++++++-----------
    1 file changed, 11 insertions(+), 11 deletions(-)

    --- a/sound/usb/quirks.c
    +++ b/sound/usb/quirks.c
    @@ -167,23 +167,18 @@ static int create_fixed_stream_quirk(str
    stream = (fp->endpoint & USB_DIR_IN)
    ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
    err = snd_usb_add_audio_stream(chip, stream, fp);
    - if (err < 0) {
    - kfree(fp);
    - kfree(rate_table);
    - return err;
    - }
    + if (err < 0)
    + goto error;
    if (fp->iface != get_iface_desc(&iface->altsetting[0])->bInterfaceNumber ||
    fp->altset_idx >= iface->num_altsetting) {
    - kfree(fp);
    - kfree(rate_table);
    - return -EINVAL;
    + err = -EINVAL;
    + goto error;
    }
    alts = &iface->altsetting[fp->altset_idx];
    altsd = get_iface_desc(alts);
    if (altsd->bNumEndpoints < 1) {
    - kfree(fp);
    - kfree(rate_table);
    - return -EINVAL;
    + err = -EINVAL;
    + goto error;
    }

    fp->protocol = altsd->bInterfaceProtocol;
    @@ -196,6 +191,11 @@ static int create_fixed_stream_quirk(str
    snd_usb_init_pitch(chip, fp->iface, alts, fp);
    snd_usb_init_sample_rate(chip, fp->iface, alts, fp, fp->rate_max);
    return 0;
    +
    + error:
    + kfree(fp);
    + kfree(rate_table);
    + return err;
    }

    static int create_auto_pcm_quirk(struct snd_usb_audio *chip,

    \
     
     \ /
      Last update: 2016-04-10 23:01    [W:4.286 / U:0.164 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site