Commit f16e666b authored by Markus Elfring's avatar Markus Elfring Committed by Takashi Iwai

ALSA: firewire: Use common error handling code in snd_motu_stream_start_duplex()

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2a0d85d9
...@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) ...@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
if (err < 0) { if (err < 0) {
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to start isochronous comm: %d\n", err); "fail to start isochronous comm: %d\n", err);
stop_both_streams(motu); goto stop_streams;
return err;
} }
err = start_isoc_ctx(motu, &motu->rx_stream); err = start_isoc_ctx(motu, &motu->rx_stream);
if (err < 0) { if (err < 0) {
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to start IT context: %d\n", err); "fail to start IT context: %d\n", err);
stop_both_streams(motu); goto stop_streams;
return err;
} }
err = protocol->switch_fetching_mode(motu, true); err = protocol->switch_fetching_mode(motu, true);
if (err < 0) { if (err < 0) {
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to enable frame fetching: %d\n", err); "fail to enable frame fetching: %d\n", err);
stop_both_streams(motu); goto stop_streams;
return err;
} }
} }
...@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate) ...@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
dev_err(&motu->unit->device, dev_err(&motu->unit->device,
"fail to start IR context: %d", err); "fail to start IR context: %d", err);
amdtp_stream_stop(&motu->rx_stream); amdtp_stream_stop(&motu->rx_stream);
stop_both_streams(motu); goto stop_streams;
return err;
} }
} }
return 0; return 0;
stop_streams:
stop_both_streams(motu);
return err;
} }
void snd_motu_stream_stop_duplex(struct snd_motu *motu) void snd_motu_stream_stop_duplex(struct snd_motu *motu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment