diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-08-23 10:30:41 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-08-23 11:39:09 +0300 |
commit | 1ae0e4ce554fb57dc4d5e1eb8e6d302e3f18b0b4 (patch) | |
tree | 788be833486080edb5de61dd15d966112b31e056 /sound/core | |
parent | dd1f7ab8a88ddc8fbb304aaca25f549e26fa8529 (diff) | |
download | linux-1ae0e4ce554fb57dc4d5e1eb8e6d302e3f18b0b4.tar.xz |
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) err = snd_timer_register_system(); if (err < 0) { pr_err("ALSA: unable to register system timer (%i)\n", err); - put_device(&timer_dev); - return err; + goto put_timer; } err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, @@ -2106,12 +2105,15 @@ static int __init alsa_timer_init(void) if (err < 0) { pr_err("ALSA: unable to register timer device (%i)\n", err); snd_timer_free_all(); - put_device(&timer_dev); - return err; + goto put_timer; } snd_timer_proc_init(); return 0; + +put_timer: + put_device(&timer_dev); + return err; } static void __exit alsa_timer_exit(void) |