Commit 2675be5a authored by Markus Elfring's avatar Markus Elfring Committed by Takashi Iwai

ALSA: rme9652: Use common error handling code in two functions

Add a jump target so that a bit of exception handling can be better reused
in these functions.

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 aa5ebc78
...@@ -5381,17 +5381,16 @@ static int snd_hdsp_probe(struct pci_dev *pci, ...@@ -5381,17 +5381,16 @@ static int snd_hdsp_probe(struct pci_dev *pci,
card->private_free = snd_hdsp_card_free; card->private_free = snd_hdsp_card_free;
hdsp->dev = dev; hdsp->dev = dev;
hdsp->pci = pci; hdsp->pci = pci;
err = snd_hdsp_create(card, hdsp);
if ((err = snd_hdsp_create(card, hdsp)) < 0) { if (err)
snd_card_free(card); goto free_card;
return err;
}
strcpy(card->shortname, "Hammerfall DSP"); strcpy(card->shortname, "Hammerfall DSP");
sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
hdsp->port, hdsp->irq); hdsp->port, hdsp->irq);
err = snd_card_register(card);
if ((err = snd_card_register(card)) < 0) { if (err) {
free_card:
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
......
...@@ -2618,19 +2618,17 @@ static int snd_rme9652_probe(struct pci_dev *pci, ...@@ -2618,19 +2618,17 @@ static int snd_rme9652_probe(struct pci_dev *pci,
card->private_free = snd_rme9652_card_free; card->private_free = snd_rme9652_card_free;
rme9652->dev = dev; rme9652->dev = dev;
rme9652->pci = pci; rme9652->pci = pci;
err = snd_rme9652_create(card, rme9652, precise_ptr[dev]);
if ((err = snd_rme9652_create(card, rme9652, precise_ptr[dev])) < 0) { if (err)
snd_card_free(card); goto free_card;
return err;
}
strcpy(card->shortname, rme9652->card_name); strcpy(card->shortname, rme9652->card_name);
sprintf(card->longname, "%s at 0x%lx, irq %d", sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname, rme9652->port, rme9652->irq); card->shortname, rme9652->port, rme9652->irq);
err = snd_card_register(card);
if (err) {
if ((err = snd_card_register(card)) < 0) { free_card:
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
......
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