From: Markus Elfring Date: Tue, 5 Sep 2017 20:22:21 +0000 (+0200) Subject: ALSA: hdspm: Use common error handling code in snd_hdspm_probe() X-Git-Tag: v4.14-rc4~21^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e35e9ddfab7e6017b38b8b75cd13756530b3b2b6;p=platform%2Fkernel%2Flinux-rpi.git 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: Markus Elfring Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 25284d8..f20d427 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6949,10 +6949,8 @@ static int snd_hdspm_probe(struct pci_dev *pci, hdspm->pci = pci; err = snd_hdspm_create(card, hdspm); - if (err < 0) { - snd_card_free(card); - return err; - } + if (err < 0) + goto free_card; if (hdspm->io_type != MADIface) { snprintf(card->shortname, sizeof(card->shortname), "%s_%x", @@ -6970,15 +6968,17 @@ static int snd_hdspm_probe(struct pci_dev *pci, } err = snd_card_register(card); - if (err < 0) { - snd_card_free(card); - return err; - } + 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_hdspm_remove(struct pci_dev *pci)