Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727450 > unrolled thread

[PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-09-06 15:20 +0200
Last post2017-09-07 10:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] ALSA: us122l: Use common error handling code in  us122l_create_card() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-09-06 15:20 +0200
    Re: [PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card() Takashi Iwai <tiwai@suse.de> - 2017-09-07 10:30 +0200

#1727450 — [PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-09-06 15:20 +0200
Subject[PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card()
Message-ID<umIpk-2iw-19@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 6 Sep 2017 14:45:09 +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/usx2y/us122l.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index b49d6e953d52..159da1f3924e 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -508,8 +508,7 @@ static bool us122l_create_card(struct snd_card *card)
 		err = us122l_create_usbmidi(card);
 	if (err < 0) {
 		snd_printk(KERN_ERR "us122l_create_usbmidi error %i \n", err);
-		us122l_stop(us122l);
-		return false;
+		goto stop;
 	}
 	err = usb_stream_hwdep_new(card);
 	if (err < 0) {
@@ -518,10 +517,13 @@ static bool us122l_create_card(struct snd_card *card)
 		list_for_each(p, &us122l->midi_list)
 			snd_usbmidi_disconnect(p);
 
-		us122l_stop(us122l);
-		return false;
+		goto stop;
 	}
 	return true;
+
+stop:
+	us122l_stop(us122l);
+	return false;
 }
 
 static void snd_us122l_free(struct snd_card *card)
-- 
2.14.1

[toc] | [next] | [standalone]


#1728022 — Re: [PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card()

FromTakashi Iwai <tiwai@suse.de>
Date2017-09-07 10:30 +0200
SubjectRe: [PATCH 1/2] ALSA: us122l: Use common error handling code in us122l_create_card()
Message-ID<un0me-5Sg-7@gated-at.bofh.it>
In reply to#1727450
On Wed, 06 Sep 2017 15:16:29 +0200,
SF Markus Elfring wrote:
> 
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Wed, 6 Sep 2017 14:45:09 +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>

Applied, thanks.


Takashi

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web