Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1717641
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe() |
| Date | 2017-08-22 20:10 +0200 |
| Message-ID | <uhlMK-5Zp-23@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-22 20:10 +0200
csiph-web