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>

authored by

Markus Elfring and committed by
Takashi Iwai
f16e666b 2a0d85d9

+8 -8
+8 -8
sound/firewire/motu/motu-stream.c
··· 253 if (err < 0) { 254 dev_err(&motu->unit->device, 255 "fail to start isochronous comm: %d\n", err); 256 - stop_both_streams(motu); 257 - return err; 258 } 259 260 err = start_isoc_ctx(motu, &motu->rx_stream); 261 if (err < 0) { 262 dev_err(&motu->unit->device, 263 "fail to start IT context: %d\n", err); 264 - stop_both_streams(motu); 265 - return err; 266 } 267 268 err = protocol->switch_fetching_mode(motu, true); 269 if (err < 0) { 270 dev_err(&motu->unit->device, 271 "fail to enable frame fetching: %d\n", err); 272 - stop_both_streams(motu); 273 - return err; 274 } 275 } 276 ··· 278 dev_err(&motu->unit->device, 279 "fail to start IR context: %d", err); 280 amdtp_stream_stop(&motu->rx_stream); 281 - stop_both_streams(motu); 282 - return err; 283 } 284 } 285 286 return 0; 287 } 288 289 void snd_motu_stream_stop_duplex(struct snd_motu *motu)
··· 253 if (err < 0) { 254 dev_err(&motu->unit->device, 255 "fail to start isochronous comm: %d\n", err); 256 + goto stop_streams; 257 } 258 259 err = start_isoc_ctx(motu, &motu->rx_stream); 260 if (err < 0) { 261 dev_err(&motu->unit->device, 262 "fail to start IT context: %d\n", err); 263 + goto stop_streams; 264 } 265 266 err = protocol->switch_fetching_mode(motu, true); 267 if (err < 0) { 268 dev_err(&motu->unit->device, 269 "fail to enable frame fetching: %d\n", err); 270 + goto stop_streams; 271 } 272 } 273 ··· 281 dev_err(&motu->unit->device, 282 "fail to start IR context: %d", err); 283 amdtp_stream_stop(&motu->rx_stream); 284 + goto stop_streams; 285 } 286 } 287 288 return 0; 289 + 290 + stop_streams: 291 + stop_both_streams(motu); 292 + return err; 293 } 294 295 void snd_motu_stream_stop_duplex(struct snd_motu *motu)