From: SF Markus Elfring <elfring@users.sourceforge.net>
To: alsa-devel@alsa-project.org, Bhumika Goyal <bhumirks@gmail.com>,
David Howells <dhowells@redhat.com>,
Fabian Frederick <fabf@skynet.be>,
Jaroslav Kysela <perex@perex.cz>,
Julia Lawall <Julia.Lawall@lip6.fr>,
Takashi Iwai <tiwai@suse.com>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe()
Date: Tue, 22 Aug 2017 20:03:50 +0200 [thread overview]
Message-ID: <1d40ad45-3841-d25b-064a-011c6de5287e@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 22 Aug 2017 19:58:30 +0200
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 <elfring@users.sourceforge.net>
---
sound/pci/cmipci.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index a460cb63e971..27817c84f6ef 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)
--
2.14.0
next reply other threads:[~2017-08-22 18:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 18:03 SF Markus Elfring [this message]
2017-08-22 18:08 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d40ad45-3841-d25b-064a-011c6de5287e@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=Julia.Lawall@lip6.fr \
--cc=alsa-devel@alsa-project.org \
--cc=bhumirks@gmail.com \
--cc=dhowells@redhat.com \
--cc=fabf@skynet.be \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®