[alsa-devel] [alsa-lib][PATCH 0/7] fix compiler warnings
Hi,
This patchset is just for fixes of compiler warnings. Nothing others.
Takashi Sakamoto (7): topology: remove unused variable in tplg_parse_fe_dai() topology: remove unused variable in get_tokens() topology: apply the same type to compared two variables topology: initialize variable for error output pcm: set error code at failure path mixer: remove assignment to unused variable pcm: add 'default' case for switch statement
modules/mixer/simple/sbase.c | 2 -- src/pcm/pcm_direct.c | 2 ++ src/pcm/pcm_hw.c | 1 + src/topology/data.c | 10 +++++----- src/topology/pcm.c | 1 - 5 files changed, 8 insertions(+), 8 deletions(-)
This commit fixes below compiler warnings.
pcm.c: In function ‘tplg_parse_fe_dai’: pcm.c:333:6: warning: unused variable ‘err’ [-Wunused-variable] int err; ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- src/topology/pcm.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/src/topology/pcm.c b/src/topology/pcm.c index efee58b..281e6ef 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -330,7 +330,6 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg, snd_config_t *cfg, snd_config_t *n; const char *id, *value = NULL; unsigned long int id_val; - int err;
snd_config_get_id(cfg, &id); tplg_dbg("\t\tFE DAI %s:\n", id);
This commit fixes below compiler warnings.
data.c: In function ‘get_tokens’: data.c:276:6: warning: unused variable ‘err’ [-Wunused-variable] int err = 0; ^ data.c: In function ‘has_tuples’: data.c:302:6: warning: unused variable ‘err’ [-Wunused-variable] int err = 0; ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- src/topology/data.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/src/topology/data.c b/src/topology/data.c index 9f8d5d0..4ecd2c2 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -273,7 +273,6 @@ static struct tplg_elem *get_tokens(snd_tplg_t *tplg, struct tplg_elem *elem) { struct tplg_ref *ref; struct list_head *base, *pos; - int err = 0;
base = &elem->ref_list; list_for_each(pos, base) { @@ -299,7 +298,6 @@ static bool has_tuples(struct tplg_elem *elem) { struct tplg_ref *ref; struct list_head *base, *pos; - int err = 0;
base = &elem->ref_list; list_for_each(pos, base) {
This commit fixes below compiler warnings.
data.c: In function ‘get_token_value’: data.c:262:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < tokens->num_tokens; i++) { ^ data.c: In function ‘copy_tuples’: data.c:351:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < tuples->num_sets ; i++) { ^ data.c:378:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (j = 0; j < tuple_set->num_tuples; j++) { ^ data.c: In function ‘tplg_free_tuples’: data.c:723:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < tuples->num_sets; i++) ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- src/topology/data.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/topology/data.c b/src/topology/data.c index 4ecd2c2..93eaf91 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -257,7 +257,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem, static int get_token_value(const char *token_id, struct tplg_vendor_tokens *tokens) { - int i; + unsigned int i;
for (i = 0; i < tokens->num_tokens; i++) { if (strcmp(token_id, tokens->token[i].id) == 0) @@ -338,7 +338,8 @@ static int copy_tuples(struct tplg_elem *elem, struct snd_soc_tplg_vendor_string_elem *string; struct snd_soc_tplg_vendor_value_elem *value; int set_size, size, off; - int i, j, token_val; + unsigned int i, j; + int token_val;
if (priv) { SNDERR("error: %s has more data than tuples\n", elem->id); @@ -713,7 +714,7 @@ int tplg_parse_tuples(snd_tplg_t *tplg, snd_config_t *cfg, void tplg_free_tuples(void *obj) { struct tplg_vendor_tuples *tuples = (struct tplg_vendor_tuples *)obj; - int i; + unsigned int i;
if (!tuples || !tuples->set) return;
This commit fixes below compiler warnings.
In file included from ../../include/local.h:165:0, from tplg_local.h:17, from data.c:20: data.c: In function ‘tplg_parse_tuples’: ../../include/error.h:64:21: warning: ‘id’ may be used uninitialized in this function [-Wmaybe-uninitialized] #define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __FUNCTION__, 0, __VA_ARGS__) /**< Shows a sound error message. */ ^ data.c:576:14: note: ‘id’ was declared here const char *id; ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- src/topology/data.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/topology/data.c b/src/topology/data.c index 93eaf91..c0a098c 100644 --- a/src/topology/data.c +++ b/src/topology/data.c @@ -578,6 +578,7 @@ static int parse_tuple_sets(snd_tplg_t *tplg, snd_config_t *cfg, int err;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) { + snd_config_get_id(cfg, &id); SNDERR("error: compound type expected for %s", id); return -EINVAL; }
This commit fixes below compiler warnings.
pcm_hw.c: In function ‘_snd_pcm_hw_open’: pcm_hw.c:1816:16: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized] return err; ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- src/pcm/pcm_hw.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 4f4b84b..1fe307f 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -1769,6 +1769,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, chmap = _snd_pcm_parse_config_chmaps(n); if (!chmap) { SNDERR("Invalid channel map for %s", id); + err = -EINVAL; goto fail; } continue;
This commit fixes below compiler warnings.
sbase.c:327:16: warning: variable ‘values’ set but not used [-Wunused-but-set-variable] unsigned long values; ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- modules/mixer/simple/sbase.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/modules/mixer/simple/sbase.c b/modules/mixer/simple/sbase.c index bb2f59d..f967703 100644 --- a/modules/mixer/simple/sbase.c +++ b/modules/mixer/simple/sbase.c @@ -324,7 +324,6 @@ static int simple_event_add1(snd_mixer_class_t *class, struct selem_base *simple; struct helem_base *hsimple; snd_ctl_elem_type_t ctype; - unsigned long values; long min, max; int err, new = 0; struct list_head *pos; @@ -349,7 +348,6 @@ static int simple_event_add1(snd_mixer_class_t *class, if (err < 0) return err; ctype = snd_ctl_elem_info_get_type(info); - values = snd_ctl_elem_info_get_count(info); switch (ctype) { case SND_CTL_ELEM_TYPE_ENUMERATED: min = 0;
This commit fixes below compiler warnings.
pcm_direct.c: In function ‘snd1_pcm_direct_prepare’: pcm_direct.c:821:2: warning: enumeration value ‘SND_PCM_STATE_PREPARED’ not handled in switch [-Wswitch] switch (snd_pcm_state(dmix->spcm)) { ^
Signed-off-by: Takashi Sakamoto o-takashi@sakamocchi.jp --- src/pcm/pcm_direct.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c index 21f98e7..a388d4a 100644 --- a/src/pcm/pcm_direct.c +++ b/src/pcm/pcm_direct.c @@ -830,6 +830,8 @@ int snd_pcm_direct_prepare(snd_pcm_t *pcm) case SND_PCM_STATE_OPEN: case SND_PCM_STATE_DISCONNECTED: return -EBADFD; + default: + break; } snd_pcm_direct_check_interleave(dmix, pcm); dmix->state = SND_PCM_STATE_PREPARED;
On Mon, 11 Jul 2016 14:05:56 +0200, Takashi Sakamoto wrote:
Hi,
This patchset is just for fixes of compiler warnings. Nothing others.
Takashi Sakamoto (7): topology: remove unused variable in tplg_parse_fe_dai() topology: remove unused variable in get_tokens() topology: apply the same type to compared two variables topology: initialize variable for error output pcm: set error code at failure path mixer: remove assignment to unused variable pcm: add 'default' case for switch statement
Thanks, applied all patches now.
Takashi
participants (2)
-
Takashi Iwai
-
Takashi Sakamoto