Skip to content

Commit af43173

Browse files
elfringtiwai
authored andcommitted
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: Markus Elfring <elfring@users.sourceforge.net> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 731209c commit af43173

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎sound/firewire/fireface/ff-pcm.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,12 @@ static int pcm_open(struct snd_pcm_substream *substream)
138138
return err;
139139

140140
err = pcm_init_hw_params(ff, substream);
141-
if (err < 0) {
142-
snd_ff_stream_lock_release(ff);
143-
return err;
144-
}
141+
if (err < 0)
142+
goto release_lock;
145143

146144
err = ff->spec->protocol->get_clock(ff, &rate, &src);
147-
if (err < 0) {
148-
snd_ff_stream_lock_release(ff);
149-
return err;
150-
}
145+
if (err < 0)
146+
goto release_lock;
151147

152148
if (src != SND_FF_CLOCK_SRC_INTERNAL) {
153149
for (i = 0; i < CIP_SFC_COUNT; ++i) {
@@ -159,8 +155,8 @@ static int pcm_open(struct snd_pcm_substream *substream)
159155
* streaming engine can't support.
160156
*/
161157
if (i >= CIP_SFC_COUNT) {
162-
snd_ff_stream_lock_release(ff);
163-
return -EIO;
158+
err = -EIO;
159+
goto release_lock;
164160
}
165161

166162
substream->runtime->hw.rate_min = rate;
@@ -177,6 +173,10 @@ static int pcm_open(struct snd_pcm_substream *substream)
177173
snd_pcm_set_sync(substream);
178174

179175
return 0;
176+
177+
release_lock:
178+
snd_ff_stream_lock_release(ff);
179+
return err;
180180
}
181181

182182
static int pcm_close(struct snd_pcm_substream *substream)

0 commit comments

Comments
 (0)