diff options
author | Wu Fengguang <wfg@linux.intel.com> | 2008-11-19 20:24:52 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-11-20 02:17:15 -0500 |
commit | 41dda0fdd2cb22d989aa76fbbbd5a6514a3e0802 (patch) | |
tree | f6384c3b2ca03650bba233798aab723b080b9431 /sound/pci/hda/hda_intel.c | |
parent | 8563964617a6685d790448d9d7e45b49be90a448 (diff) |
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: Wu Fengguang <wfg@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index f73c13fdd409..3870ad622da6 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2317,40 +2317,30 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2317 | } | 2317 | } |
2318 | 2318 | ||
2319 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); | 2319 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); |
2320 | if (err < 0) { | 2320 | if (err < 0) |
2321 | snd_card_free(card); | 2321 | goto out_free; |
2322 | return err; | ||
2323 | } | ||
2324 | card->private_data = chip; | 2322 | card->private_data = chip; |
2325 | 2323 | ||
2326 | /* create codec instances */ | 2324 | /* create codec instances */ |
2327 | err = azx_codec_create(chip, model[dev], probe_mask[dev]); | 2325 | err = azx_codec_create(chip, model[dev], probe_mask[dev]); |
2328 | if (err < 0) { | 2326 | if (err < 0) |
2329 | snd_card_free(card); | 2327 | goto out_free; |
2330 | return err; | ||
2331 | } | ||
2332 | 2328 | ||
2333 | /* create PCM streams */ | 2329 | /* create PCM streams */ |
2334 | err = snd_hda_build_pcms(chip->bus); | 2330 | err = snd_hda_build_pcms(chip->bus); |
2335 | if (err < 0) { | 2331 | if (err < 0) |
2336 | snd_card_free(card); | 2332 | goto out_free; |
2337 | return err; | ||
2338 | } | ||
2339 | 2333 | ||
2340 | /* create mixer controls */ | 2334 | /* create mixer controls */ |
2341 | err = azx_mixer_create(chip); | 2335 | err = azx_mixer_create(chip); |
2342 | if (err < 0) { | 2336 | if (err < 0) |
2343 | snd_card_free(card); | 2337 | goto out_free; |
2344 | return err; | ||
2345 | } | ||
2346 | 2338 | ||
2347 | snd_card_set_dev(card, &pci->dev); | 2339 | snd_card_set_dev(card, &pci->dev); |
2348 | 2340 | ||
2349 | err = snd_card_register(card); | 2341 | err = snd_card_register(card); |
2350 | if (err < 0) { | 2342 | if (err < 0) |
2351 | snd_card_free(card); | 2343 | goto out_free; |
2352 | return err; | ||
2353 | } | ||
2354 | 2344 | ||
2355 | pci_set_drvdata(pci, card); | 2345 | pci_set_drvdata(pci, card); |
2356 | chip->running = 1; | 2346 | chip->running = 1; |
@@ -2359,6 +2349,9 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2359 | 2349 | ||
2360 | dev++; | 2350 | dev++; |
2361 | return err; | 2351 | return err; |
2352 | out_free: | ||
2353 | snd_card_free(card); | ||
2354 | return err; | ||
2362 | } | 2355 | } |
2363 | 2356 | ||
2364 | static void __devexit azx_remove(struct pci_dev *pci) | 2357 | static void __devexit azx_remove(struct pci_dev *pci) |