summaryrefslogtreecommitdiffstats
path: root/sound/firewire/motu
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-09-06 07:30:14 -0400
committerTakashi Iwai <tiwai@suse.de>2017-09-12 03:23:26 -0400
commitf16e666b9b7e07237ca0669df9b89ccf8dfc102c (patch)
tree786a78f2756fee9b20e5dbf6a9266c13c26676c2 /sound/firewire/motu
parent2a0d85d9add77bb7a4ddd61557ffb21ca5370d15 (diff)
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: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu')
-rw-r--r--sound/firewire/motu/motu-stream.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/firewire/motu/motu-stream.c b/sound/firewire/motu/motu-stream.c
index dc5541c8b359..73e7a5e527fc 100644
--- a/sound/firewire/motu/motu-stream.c
+++ b/sound/firewire/motu/motu-stream.c
@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
253 if (err < 0) { 253 if (err < 0) {
254 dev_err(&motu->unit->device, 254 dev_err(&motu->unit->device,
255 "fail to start isochronous comm: %d\n", err); 255 "fail to start isochronous comm: %d\n", err);
256 stop_both_streams(motu); 256 goto stop_streams;
257 return err;
258 } 257 }
259 258
260 err = start_isoc_ctx(motu, &motu->rx_stream); 259 err = start_isoc_ctx(motu, &motu->rx_stream);
261 if (err < 0) { 260 if (err < 0) {
262 dev_err(&motu->unit->device, 261 dev_err(&motu->unit->device,
263 "fail to start IT context: %d\n", err); 262 "fail to start IT context: %d\n", err);
264 stop_both_streams(motu); 263 goto stop_streams;
265 return err;
266 } 264 }
267 265
268 err = protocol->switch_fetching_mode(motu, true); 266 err = protocol->switch_fetching_mode(motu, true);
269 if (err < 0) { 267 if (err < 0) {
270 dev_err(&motu->unit->device, 268 dev_err(&motu->unit->device,
271 "fail to enable frame fetching: %d\n", err); 269 "fail to enable frame fetching: %d\n", err);
272 stop_both_streams(motu); 270 goto stop_streams;
273 return err;
274 } 271 }
275 } 272 }
276 273
@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
281 dev_err(&motu->unit->device, 278 dev_err(&motu->unit->device,
282 "fail to start IR context: %d", err); 279 "fail to start IR context: %d", err);
283 amdtp_stream_stop(&motu->rx_stream); 280 amdtp_stream_stop(&motu->rx_stream);
284 stop_both_streams(motu); 281 goto stop_streams;
285 return err;
286 } 282 }
287 } 283 }
288 284
289 return 0; 285 return 0;
286
287stop_streams:
288 stop_both_streams(motu);
289 return err;
290} 290}
291 291
292void snd_motu_stream_stop_duplex(struct snd_motu *motu) 292void snd_motu_stream_stop_duplex(struct snd_motu *motu)