Commit 1ae0e4ce authored by Markus Elfring's avatar Markus Elfring Committed by Takashi Iwai

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent dd1f7ab8
...@@ -2097,8 +2097,7 @@ static int __init alsa_timer_init(void) ...@@ -2097,8 +2097,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system(); err = snd_timer_register_system();
if (err < 0) { if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err); pr_err("ALSA: unable to register system timer (%i)\n", err);
put_device(&timer_dev); goto put_timer;
return err;
} }
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
...@@ -2106,12 +2105,15 @@ static int __init alsa_timer_init(void) ...@@ -2106,12 +2105,15 @@ static int __init alsa_timer_init(void)
if (err < 0) { if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err); pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all(); snd_timer_free_all();
put_device(&timer_dev); goto put_timer;
return err;
} }
snd_timer_proc_init(); snd_timer_proc_init();
return 0; return 0;
put_timer:
put_device(&timer_dev);
return err;
} }
static void __exit alsa_timer_exit(void) static void __exit alsa_timer_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment