Commit 41dda0fd authored by Wu Fengguang's avatar Wu Fengguang Committed by Takashi Iwai

ALSA: azx_probe() cleanup

Replace 5 free-and-return-err blocks with goto-out-free ones.
This makes the main logic more outstanding.
Signed-off-by: default avatarWu Fengguang <wfg@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 85639646
...@@ -2317,40 +2317,30 @@ static int __devinit azx_probe(struct pci_dev *pci, ...@@ -2317,40 +2317,30 @@ static int __devinit azx_probe(struct pci_dev *pci,
} }
err = azx_create(card, pci, dev, pci_id->driver_data, &chip); err = azx_create(card, pci, dev, pci_id->driver_data, &chip);
if (err < 0) { if (err < 0)
snd_card_free(card); goto out_free;
return err;
}
card->private_data = chip; card->private_data = chip;
/* create codec instances */ /* create codec instances */
err = azx_codec_create(chip, model[dev], probe_mask[dev]); err = azx_codec_create(chip, model[dev], probe_mask[dev]);
if (err < 0) { if (err < 0)
snd_card_free(card); goto out_free;
return err;
}
/* create PCM streams */ /* create PCM streams */
err = snd_hda_build_pcms(chip->bus); err = snd_hda_build_pcms(chip->bus);
if (err < 0) { if (err < 0)
snd_card_free(card); goto out_free;
return err;
}
/* create mixer controls */ /* create mixer controls */
err = azx_mixer_create(chip); err = azx_mixer_create(chip);
if (err < 0) { if (err < 0)
snd_card_free(card); goto out_free;
return err;
}
snd_card_set_dev(card, &pci->dev); snd_card_set_dev(card, &pci->dev);
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0)
snd_card_free(card); goto out_free;
return err;
}
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
chip->running = 1; chip->running = 1;
...@@ -2359,6 +2349,9 @@ static int __devinit azx_probe(struct pci_dev *pci, ...@@ -2359,6 +2349,9 @@ static int __devinit azx_probe(struct pci_dev *pci,
dev++; dev++;
return err; return err;
out_free:
snd_card_free(card);
return err;
} }
static void __devexit azx_remove(struct pci_dev *pci) static void __devexit azx_remove(struct pci_dev *pci)
......
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