summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2026-06-18 13:24:36 +0300
committerTakashi Iwai <tiwai@suse.de>2026-06-18 18:50:30 +0300
commitb59aff62767bf59ca0c787015c0ddc14f60ab10d (patch)
treeeabd4737eb682eb697265e5a85c8b1593aa8e8fb
parent348f69320e4db6ebec6940c81154bec4b9eb275a (diff)
downloadlinux-b59aff62767bf59ca0c787015c0ddc14f60ab10d.tar.xz
ALSA: emu10k1: Use common error handling code in snd_emu10k1_playback_open()
Use an additional label so that a bit of exception handling can be better reused at the end of this function implementation. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://patch.msgid.link/d709474d-62b0-4f7e-9011-a0f716b35383@web.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/emu10k1/emupcm.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 9023f3444d20..b8749e0131ad 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1181,19 +1181,17 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)
runtime->private_free = snd_emu10k1_pcm_free_substream;
runtime->hw = snd_emu10k1_playback;
err = snd_emu10k1_playback_set_constraints(runtime);
- if (err < 0) {
- kfree(epcm);
- return err;
- }
+ if (err < 0)
+ goto free_epcm;
+
if (emu->card_capabilities->emu_model)
sample_rate = emu->emu1010.word_clock;
else
sample_rate = 48000;
err = snd_pcm_hw_rule_noresample(runtime, sample_rate);
- if (err < 0) {
- kfree(epcm);
- return err;
- }
+ if (err < 0)
+ goto free_epcm;
+
mix = &emu->pcm_mixer[substream->number];
for (i = 0; i < 8; i++)
mix->send_routing[0][i] = mix->send_routing[1][i] = mix->send_routing[2][i] = i;
@@ -1204,6 +1202,10 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)
mix->epcm = epcm;
snd_emu10k1_pcm_mixer_notify(emu, substream->number, 1);
return 0;
+
+free_epcm:
+ kfree(epcm);
+ return err;
}
static int snd_emu10k1_playback_close(struct snd_pcm_substream *substream)