Skip to content

Commit

Permalink
ALSA: firewire: Use common error handling code in snd_motu_stream_sta…
Browse files Browse the repository at this point in the history
…rt_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>
  • Loading branch information
elfring authored and tiwai committed Sep 12, 2017
1 parent 2a0d85d commit f16e666
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sound/firewire/motu/motu-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,24 +253,21 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
if (err < 0) {
dev_err(&motu->unit->device,
"fail to start isochronous comm: %d\n", err);
stop_both_streams(motu);
return err;
goto stop_streams;
}

err = start_isoc_ctx(motu, &motu->rx_stream);
if (err < 0) {
dev_err(&motu->unit->device,
"fail to start IT context: %d\n", err);
stop_both_streams(motu);
return err;
goto stop_streams;
}

err = protocol->switch_fetching_mode(motu, true);
if (err < 0) {
dev_err(&motu->unit->device,
"fail to enable frame fetching: %d\n", err);
stop_both_streams(motu);
return err;
goto stop_streams;
}
}

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

return 0;

stop_streams:
stop_both_streams(motu);
return err;
}

void snd_motu_stream_stop_duplex(struct snd_motu *motu)
Expand Down

0 comments on commit f16e666

Please sign in to comment.