diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-09-06 16:00:08 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-09-07 11:28:30 +0300 |
commit | d2d977087970526ac7c8b08a492081ea2e1f6c29 (patch) | |
tree | 2da9a3070c0a60bcbce8c91fce766bd1c718b1d6 /sound | |
parent | 80753cdfef2a16a71d7c6b5aafe9700a2650913c (diff) | |
download | linux-d2d977087970526ac7c8b08a492081ea2e1f6c29.tar.xz |
ALSA: usx2y: Use common error handling code in submit_urbs()
Add a jump target so that a bit of exception handling can be better reused
at the end of this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/usx2y/usb_stream.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index fe926cb9192e..4dab49080700 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -352,20 +352,22 @@ static int submit_urbs(struct usb_stream_kernel *sk, int err; prepare_inurb(sk->idle_outurb->number_of_packets, sk->idle_inurb); err = usb_submit_urb(sk->idle_inurb, GFP_ATOMIC); - if (err < 0) { - snd_printk(KERN_ERR "%i\n", err); - return err; - } + if (err < 0) + goto report_failure; + sk->idle_inurb = sk->completed_inurb; sk->completed_inurb = inurb; err = usb_submit_urb(sk->idle_outurb, GFP_ATOMIC); - if (err < 0) { - snd_printk(KERN_ERR "%i\n", err); - return err; - } + if (err < 0) + goto report_failure; + sk->idle_outurb = sk->completed_outurb; sk->completed_outurb = outurb; return 0; + +report_failure: + snd_printk(KERN_ERR "%i\n", err); + return err; } #ifdef DEBUG_LOOP_BACK |