Skip to content

Commit f16e666

Browse files
elfringtiwai
authored andcommitted
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 <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent 2a0d85d commit f16e666

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sound/firewire/motu/motu-stream.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
253253
if (err < 0) {
254254
dev_err(&motu->unit->device,
255255
"fail to start isochronous comm: %d\n", err);
256-
stop_both_streams(motu);
257-
return err;
256+
goto stop_streams;
258257
}
259258

260259
err = start_isoc_ctx(motu, &motu->rx_stream);
261260
if (err < 0) {
262261
dev_err(&motu->unit->device,
263262
"fail to start IT context: %d\n", err);
264-
stop_both_streams(motu);
265-
return err;
263+
goto stop_streams;
266264
}
267265

268266
err = protocol->switch_fetching_mode(motu, true);
269267
if (err < 0) {
270268
dev_err(&motu->unit->device,
271269
"fail to enable frame fetching: %d\n", err);
272-
stop_both_streams(motu);
273-
return err;
270+
goto stop_streams;
274271
}
275272
}
276273

@@ -281,12 +278,15 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
281278
dev_err(&motu->unit->device,
282279
"fail to start IR context: %d", err);
283280
amdtp_stream_stop(&motu->rx_stream);
284-
stop_both_streams(motu);
285-
return err;
281+
goto stop_streams;
286282
}
287283
}
288284

289285
return 0;
286+
287+
stop_streams:
288+
stop_both_streams(motu);
289+
return err;
290290
}
291291

292292
void snd_motu_stream_stop_duplex(struct snd_motu *motu)

0 commit comments

Comments
 (0)