Commit e35e9ddf authored by Markus Elfring's avatar Markus Elfring Committed by Takashi Iwai

ALSA: hdspm: Use common error handling code in snd_hdspm_probe()

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 99dcad32
...@@ -6949,10 +6949,8 @@ static int snd_hdspm_probe(struct pci_dev *pci, ...@@ -6949,10 +6949,8 @@ static int snd_hdspm_probe(struct pci_dev *pci,
hdspm->pci = pci; hdspm->pci = pci;
err = snd_hdspm_create(card, hdspm); err = snd_hdspm_create(card, hdspm);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
if (hdspm->io_type != MADIface) { if (hdspm->io_type != MADIface) {
snprintf(card->shortname, sizeof(card->shortname), "%s_%x", snprintf(card->shortname, sizeof(card->shortname), "%s_%x",
...@@ -6970,15 +6968,17 @@ static int snd_hdspm_probe(struct pci_dev *pci, ...@@ -6970,15 +6968,17 @@ static int snd_hdspm_probe(struct pci_dev *pci,
} }
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
pci_set_drvdata(pci, card); pci_set_drvdata(pci, card);
dev++; dev++;
return 0; return 0;
free_card:
snd_card_free(card);
return err;
} }
static void snd_hdspm_remove(struct pci_dev *pci) static void snd_hdspm_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