aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-01-29 12:09:05 -0500
committerTakashi Iwai <tiwai@suse.de>2015-02-02 08:42:44 -0500
commit7c35860d1ae555a040f561c7cfdde066053787f0 (patch)
tree734792b3d4c9efb5da4ce73aba97cca0d02d672a /sound/core
parent07cc3e8bd57cd9d9f8f30c30ed859a55a7d8f4d3 (diff)
ALSA: timer: Propagate the error at initialization
... instead of just printing errors. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/timer.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 777a45e08e53..28b673d4f812 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -1942,6 +1942,15 @@ static const struct file_operations snd_timer_f_ops =
1942 .fasync = snd_timer_user_fasync, 1942 .fasync = snd_timer_user_fasync,
1943}; 1943};
1944 1944
1945/* unregister the system timer */
1946static void snd_timer_free_all(void)
1947{
1948 struct snd_timer *timer, *n;
1949
1950 list_for_each_entry_safe(timer, n, &snd_timer_list, device_list)
1951 snd_timer_free(timer);
1952}
1953
1945/* 1954/*
1946 * ENTRY functions 1955 * ENTRY functions
1947 */ 1956 */
@@ -1955,25 +1964,28 @@ static int __init alsa_timer_init(void)
1955 "system timer"); 1964 "system timer");
1956#endif 1965#endif
1957 1966
1958 if ((err = snd_timer_register_system()) < 0) 1967 err = snd_timer_register_system();
1968 if (err < 0) {
1959 pr_err("ALSA: unable to register system timer (%i)\n", err); 1969 pr_err("ALSA: unable to register system timer (%i)\n", err);
1960 if ((err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, 1970 return err;
1961 &snd_timer_f_ops, NULL, "timer")) < 0) 1971 }
1972
1973 err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
1974 &snd_timer_f_ops, NULL, "timer");
1975 if (err < 0) {
1962 pr_err("ALSA: unable to register timer device (%i)\n", err); 1976 pr_err("ALSA: unable to register timer device (%i)\n", err);
1977 snd_timer_free_all();
1978 return err;
1979 }
1980
1963 snd_timer_proc_init(); 1981 snd_timer_proc_init();
1964 return 0; 1982 return 0;
1965} 1983}
1966 1984
1967static void __exit alsa_timer_exit(void) 1985static void __exit alsa_timer_exit(void)
1968{ 1986{
1969 struct list_head *p, *n;
1970
1971 snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0); 1987 snd_unregister_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0);
1972 /* unregister the system timer */ 1988 snd_timer_free_all();
1973 list_for_each_safe(p, n, &snd_timer_list) {
1974 struct snd_timer *timer = list_entry(p, struct snd_timer, device_list);
1975 snd_timer_free(timer);
1976 }
1977 snd_timer_proc_done(); 1989 snd_timer_proc_done();
1978#ifdef SNDRV_OSS_INFO_DEV_TIMERS 1990#ifdef SNDRV_OSS_INFO_DEV_TIMERS
1979 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1); 1991 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_TIMERS, SNDRV_CARDS - 1);