@@ -1569,38 +1569,33 @@ static int snd_emu10k1x_probe(struct pci_dev *pci,
if (err < 0)
return err;
- if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_emu10k1x_create(card, pci, &chip);
+ if (err < 0)
+ goto free_card;
- if ((err = snd_emu10k1x_pcm(chip, 0)) < 0) {
- snd_card_free(card);
- return err;
- }
- if ((err = snd_emu10k1x_pcm(chip, 1)) < 0) {
- snd_card_free(card);
- return err;
- }
- if ((err = snd_emu10k1x_pcm(chip, 2)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_emu10k1x_pcm(chip, 0);
+ if (err < 0)
+ goto free_card;
- if ((err = snd_emu10k1x_ac97(chip)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_emu10k1x_pcm(chip, 1);
+ if (err < 0)
+ goto free_card;
- if ((err = snd_emu10k1x_mixer(chip)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_emu10k1x_pcm(chip, 2);
+ if (err < 0)
+ goto free_card;
+
+ err = snd_emu10k1x_ac97(chip);
+ if (err < 0)
+ goto free_card;
+
+ err = snd_emu10k1x_mixer(chip);
+ if (err < 0)
+ goto free_card;
- if ((err = snd_emu10k1x_midi(chip)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_emu10k1x_midi(chip);
+ if (err < 0)
+ goto free_card;
snd_emu10k1x_proc_init(chip);
@@ -1609,14 +1604,17 @@ static int snd_emu10k1x_probe(struct pci_dev *pci,
sprintf(card->longname, "%s at 0x%lx irq %i",
card->shortname, chip->port, chip->irq);
- if ((err = snd_card_register(card)) < 0) {
- snd_card_free(card);
- return err;
- }
+ err = snd_card_register(card);
+ if (err < 0)
+ goto free_card;
pci_set_drvdata(pci, card);
dev++;
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static void snd_emu10k1x_remove(struct pci_dev *pci)
@@ -1143,23 +1143,26 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)
runtime->private_data = epcm;
runtime->private_free = snd_emu10k1_pcm_free_substream;
runtime->hw = snd_emu10k1_playback;
- if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) {
- kfree(epcm);
- return err;
- }
- if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0) {
- kfree(epcm);
- return err;
- }
+ err = snd_pcm_hw_constraint_integer(runtime,
+ SNDRV_PCM_HW_PARAM_PERIODS);
+ if (err < 0)
+ goto free_pcm;
+
+ err = snd_pcm_hw_constraint_minmax(runtime,
+ SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
+ 256,
+ UINT_MAX);
+ if (err < 0)
+ goto free_pcm;
+
if (emu->card_capabilities->emu_model && emu->emu1010.internal_clock == 0)
sample_rate = 44100;
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_pcm;
+
mix = &emu->pcm_mixer[substream->number];
for (i = 0; i < 4; i++)
mix->send_routing[0][i] = mix->send_routing[1][i] = mix->send_routing[2][i] = i;
@@ -1170,6 +1173,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_pcm:
+ kfree(epcm);
+ return err;
}
static int snd_emu10k1_playback_close(struct snd_pcm_substream *substream)