@@ -893,18 +893,19 @@ static int snd_sgio2audio_create(struct snd_card *card,
/* initialize the AD1843 codec */
err = ad1843_init(&chip->ad1843);
- if (err < 0) {
- snd_sgio2audio_free(chip);
- return err;
- }
+ if (err < 0)
+ goto free_chip;
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
- if (err < 0) {
- snd_sgio2audio_free(chip);
- return err;
- }
+ if (err < 0)
+ goto free_chip;
+
*rchip = chip;
return 0;
+
+free_chip:
+ snd_sgio2audio_free(chip);
+ return err;
}
static int snd_sgio2audio_probe(struct platform_device *pdev)
@@ -918,21 +919,16 @@ static int snd_sgio2audio_probe(struct platform_device *pdev)
return err;
err = snd_sgio2audio_create(card, &chip);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
err = snd_sgio2audio_new_pcm(chip);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
err = snd_sgio2audio_new_mixer(chip);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
strcpy(card->driver, "SGI O2 Audio");
strcpy(card->shortname, "SGI O2 Audio");
@@ -942,12 +938,15 @@ static int snd_sgio2audio_probe(struct platform_device *pdev)
MACEISA_AUDIO3_MERR_IRQ);
err = snd_card_register(card);
- if (err < 0) {
- snd_card_free(card);
- return err;
- }
+ if (err < 0)
+ goto free_card;
+
platform_set_drvdata(pdev, card);
return 0;
+
+free_card:
+ snd_card_free(card);
+ return err;
}
static int snd_sgio2audio_remove(struct platform_device *pdev)