From f422fb9a787dc0c4ec662c050894842004a754ee Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 27 Dec 2001 20:55:53 +0000 Subject: [PATCH] Added missing variable initialization in open_conf() functions (hwdep, timer); Uros --- src/hwdep/hwdep.c | 7 ++----- src/seq/seq.c | 2 ++ src/timer/timer.c | 6 +----- src/timer/timer_query.c | 7 ++----- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/hwdep/hwdep.c b/src/hwdep/hwdep.c index cba186b5..95b18e28 100644 --- a/src/hwdep/hwdep.c +++ b/src/hwdep/hwdep.c @@ -119,6 +119,7 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep, h = snd_dlopen(lib, RTLD_NOW); if (h) open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION)); + err = 0; if (!h) { SNDERR("Cannot open shared library %s", lib); err = -ENOENT; @@ -130,11 +131,7 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep, _err: if (type_conf) snd_config_delete(type_conf); - if (err >= 0) - err = open_func(hwdep, name, hwdep_root, hwdep_conf, mode); - if (err < 0) - return err; - return 0; + return err >= 0 ? open_func(hwdep, name, hwdep_root, hwdep_conf, mode) : err; } static int snd_hwdep_open_noupdate(snd_hwdep_t **hwdep, snd_config_t *root, const char *name, int mode) diff --git a/src/seq/seq.c b/src/seq/seq.c index 26c5fede..75fbb89c 100644 --- a/src/seq/seq.c +++ b/src/seq/seq.c @@ -134,6 +134,8 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name, continue; } SNDERR("Unknown field %s", id); + err = -EINVAL; + goto _err; } } if (!open_name) { diff --git a/src/timer/timer.c b/src/timer/timer.c index 352c10e3..c08d44a6 100644 --- a/src/timer/timer.c +++ b/src/timer/timer.c @@ -130,11 +130,7 @@ static int snd_timer_open_conf(snd_timer_t **timer, _err: if (type_conf) snd_config_delete(type_conf); - if (err >= 0) - err = open_func(timer, name, timer_root, timer_conf, mode); - if (err < 0) - return err; - return 0; + return err >= 0 ? open_func(timer, name, timer_root, timer_conf, mode) : err; } static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t *root, const char *name, int mode) diff --git a/src/timer/timer_query.c b/src/timer/timer_query.c index 121c77e3..2afab11a 100644 --- a/src/timer/timer_query.c +++ b/src/timer/timer_query.c @@ -117,6 +117,7 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer, h = snd_dlopen(lib, RTLD_NOW); if (h) open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION)); + err = 0; if (!h) { SNDERR("Cannot open shared library %s", lib); err = -ENOENT; @@ -128,11 +129,7 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer, _err: if (type_conf) snd_config_delete(type_conf); - if (err >= 0) - err = open_func(timer, name, timer_root, timer_conf, mode); - if (err < 0) - return err; - return 0; + return err >= 0 ? open_func(timer, name, timer_root, timer_conf, mode) : err; } static int snd_timer_query_open_noupdate(snd_timer_query_t **timer, snd_config_t *root, const char *name, int mode) -- 2.47.1