* [PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe()
@ 2017-08-22 18:03 SF Markus Elfring
2017-08-22 18:08 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2017-08-22 18:03 UTC (permalink / raw)
To: alsa-devel, Bhumika Goyal, David Howells, Fabian Frederick,
Jaroslav Kysela, Julia Lawall, Takashi Iwai
Cc: kernel-janitors, LKML
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe()
2017-08-22 18:03 [PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe() SF Markus Elfring
@ 2017-08-22 18:08 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2017-08-22 18:08 UTC (permalink / raw)
To: SF Markus Elfring
Cc: alsa-devel, Bhumika Goyal, Julia Lawall, Jaroslav Kysela,
David Howells, Fabian Frederick, kernel-janitors, LKML
On Tue, 22 Aug 2017 20:03:50 +0200,
SF Markus Elfring wrote:
>
> 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>
Thanks, applied.
But, if you'll be working further on the similar changes, please
gather them and post once as a patch series, instead of posting
spontaneously one by one after each half an hour. This is quite
annoying for maintainers.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-22 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 18:03 [PATCH] ALSA: cmipci: Use common error handling code in snd_cmipci_probe() SF Markus Elfring
2017-08-22 18:08 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox