From: SF Markus Elfring <elfring@users.sourceforge.net>
To: alsa-devel@alsa-project.org,
Arvind Yadav <arvind.yadav.cs@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Torsten Schenk <torsten.schenk@zoho.com>
Cc: kernel-janitors@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] ALSA: 6Fire: Use common error handling code in usb6fire_chip_probe()
Date: Wed, 06 Sep 2017 14:38:25 +0000 [thread overview]
Message-ID: <6b3e5ec7-557c-4330-4fa4-221530d6c811@users.sourceforge.net> (raw)
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 16:26:29 +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/usb/6fire/chip.c | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index bc2a24f7a791..c7641cb50616 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -143,37 +143,32 @@ static int usb6fire_chip_probe(struct usb_interface *intf,
chip->card = card;
ret = usb6fire_comm_init(chip);
- if (ret < 0) {
- usb6fire_chip_destroy(chip);
- return ret;
- }
+ if (ret < 0)
+ goto destroy_chip;
ret = usb6fire_midi_init(chip);
- if (ret < 0) {
- usb6fire_chip_destroy(chip);
- return ret;
- }
+ if (ret < 0)
+ goto destroy_chip;
ret = usb6fire_pcm_init(chip);
- if (ret < 0) {
- usb6fire_chip_destroy(chip);
- return ret;
- }
+ if (ret < 0)
+ goto destroy_chip;
ret = usb6fire_control_init(chip);
- if (ret < 0) {
- usb6fire_chip_destroy(chip);
- return ret;
- }
+ if (ret < 0)
+ goto destroy_chip;
ret = snd_card_register(card);
if (ret < 0) {
dev_err(&intf->dev, "cannot register card.");
- usb6fire_chip_destroy(chip);
- return ret;
+ goto destroy_chip;
}
usb_set_intfdata(intf, chip);
return 0;
+
+destroy_chip:
+ usb6fire_chip_destroy(chip);
+ return ret;
}
static void usb6fire_chip_disconnect(struct usb_interface *intf)
--
2.14.1
next reply other threads:[~2017-09-06 14:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 14:38 SF Markus Elfring [this message]
2017-09-07 8:30 ` [PATCH] ALSA: 6Fire: Use common error handling code in usb6fire_chip_probe() 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=6b3e5ec7-557c-4330-4fa4-221530d6c811@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=alsa-devel@alsa-project.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=torsten.schenk@zoho.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