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

ALSA: fireface: Use common error handling code in pcm_open()

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>
Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 731209cc
...@@ -138,16 +138,12 @@ static int pcm_open(struct snd_pcm_substream *substream) ...@@ -138,16 +138,12 @@ static int pcm_open(struct snd_pcm_substream *substream)
return err; return err;
err = pcm_init_hw_params(ff, substream); err = pcm_init_hw_params(ff, substream);
if (err < 0) { if (err < 0)
snd_ff_stream_lock_release(ff); goto release_lock;
return err;
}
err = ff->spec->protocol->get_clock(ff, &rate, &src); err = ff->spec->protocol->get_clock(ff, &rate, &src);
if (err < 0) { if (err < 0)
snd_ff_stream_lock_release(ff); goto release_lock;
return err;
}
if (src != SND_FF_CLOCK_SRC_INTERNAL) { if (src != SND_FF_CLOCK_SRC_INTERNAL) {
for (i = 0; i < CIP_SFC_COUNT; ++i) { for (i = 0; i < CIP_SFC_COUNT; ++i) {
...@@ -159,8 +155,8 @@ static int pcm_open(struct snd_pcm_substream *substream) ...@@ -159,8 +155,8 @@ static int pcm_open(struct snd_pcm_substream *substream)
* streaming engine can't support. * streaming engine can't support.
*/ */
if (i >= CIP_SFC_COUNT) { if (i >= CIP_SFC_COUNT) {
snd_ff_stream_lock_release(ff); err = -EIO;
return -EIO; goto release_lock;
} }
substream->runtime->hw.rate_min = rate; substream->runtime->hw.rate_min = rate;
...@@ -177,6 +173,10 @@ static int pcm_open(struct snd_pcm_substream *substream) ...@@ -177,6 +173,10 @@ static int pcm_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream); snd_pcm_set_sync(substream);
return 0; return 0;
release_lock:
snd_ff_stream_lock_release(ff);
return err;
} }
static int pcm_close(struct snd_pcm_substream *substream) static int pcm_close(struct snd_pcm_substream *substream)
......
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