From: Markus Elfring Date: Tue, 22 Aug 2017 17:58:30 +0000 (+0200) Subject: ALSA: cmipci: Use common error handling code in snd_cmipci_probe() X-Git-Tag: v4.14-rc4~21^2~27^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e17a85eccfa0b7d0089af218b0c468d4b8a3c3c2;p=platform%2Fkernel%2Flinux-rpi.git ALSA: cmipci: Use common error handling code in snd_cmipci_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: Markus Elfring Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index a45245f..26a6578 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -3295,20 +3295,23 @@ static int snd_cmipci_probe(struct pci_dev *pci, break; } - if ((err = snd_cmipci_create(card, pci, dev, &cm)) < 0) { - snd_card_free(card); - return err; - } + err = snd_cmipci_create(card, pci, dev, &cm); + if (err < 0) + goto free_card; + card->private_data = cm; - if ((err = snd_card_register(card)) < 0) { - snd_card_free(card); - return err; - } + err = snd_card_register(card); + if (err < 0) + goto free_card; + pci_set_drvdata(pci, card); dev++; return 0; +free_card: + snd_card_free(card); + return err; } static void snd_cmipci_remove(struct pci_dev *pci)