diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-23 03:30:41 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-08-23 04:39:09 -0400 |
commit | 1ae0e4ce554fb57dc4d5e1eb8e6d302e3f18b0b4 (patch) | |
tree | 788be833486080edb5de61dd15d966112b31e056 /sound/core | |
parent | dd1f7ab8a88ddc8fbb304aaca25f549e26fa8529 (diff) |
ALSA: timer: Use common error handling code in alsa_timer_init()
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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/timer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c index 6051aed3197f..6cdd04a45962 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c | |||
@@ -2097,8 +2097,7 @@ static int __init alsa_timer_init(void) | |||
2097 | err = snd_timer_register_system(); | 2097 | err = snd_timer_register_system(); |
2098 | if (err < 0) { | 2098 | if (err < 0) { |
2099 | pr_err("ALSA: unable to register system timer (%i)\n", err); | 2099 | pr_err("ALSA: unable to register system timer (%i)\n", err); |
2100 | put_device(&timer_dev); | 2100 | goto put_timer; |
2101 | return err; | ||
2102 | } | 2101 | } |
2103 | 2102 | ||
2104 | err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, | 2103 | err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, |
@@ -2106,12 +2105,15 @@ static int __init alsa_timer_init(void) | |||
2106 | if (err < 0) { | 2105 | if (err < 0) { |
2107 | pr_err("ALSA: unable to register timer device (%i)\n", err); | 2106 | pr_err("ALSA: unable to register timer device (%i)\n", err); |
2108 | snd_timer_free_all(); | 2107 | snd_timer_free_all(); |
2109 | put_device(&timer_dev); | 2108 | goto put_timer; |
2110 | return err; | ||
2111 | } | 2109 | } |
2112 | 2110 | ||
2113 | snd_timer_proc_init(); | 2111 | snd_timer_proc_init(); |
2114 | return 0; | 2112 | return 0; |
2113 | |||
2114 | put_timer: | ||
2115 | put_device(&timer_dev); | ||
2116 | return err; | ||
2115 | } | 2117 | } |
2116 | 2118 | ||
2117 | static void __exit alsa_timer_exit(void) | 2119 | static void __exit alsa_timer_exit(void) |