]> git.alsa-project.org Git - alsa-utils.git/commitdiff
axfer/test: fix uninitialized warning
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 6 May 2019 20:48:47 +0000 (05:48 +0900)
committerJaroslav Kysela <perex@perex.cz>
Tue, 7 May 2019 06:33:01 +0000 (08:33 +0200)
This commit fixes uninitialized return value from a call of test_mux() and
text_demux() to suppress warnings below:

$ make check
...
gcc -DHAVE_CONFIG_H -I. -I../../include     -O2 -Wall -pipe -g -MT mapper-test.o -MD -MP -MF .deps/mapper-test.Tpo -c -o mapper-test.o mapper-test.c
mapper-test.c: In function ‘test_mapper’:
mapper-test.c:241:9: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  return err;
         ^~~
mapper-test.c:231:5: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (err < 0)
     ^

Fixes: 39d1ab8a0cb4: ('axfer: add a unit test for mapper interface')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
axfer/test/mapper-test.c

index 3dfcf50ac5257ce8bad252d81cbeba679f4f88bb..6b24d547037e1d00ce5bbe1b41cb1ebb5697cd6c 100644 (file)
@@ -71,7 +71,7 @@ static int test_demux(struct mapper_trial *trial, snd_pcm_access_t access,
        unsigned int bytes_per_sample;
        uint64_t total_frame_count;
        int i;
-       int err;
+       int err = 0;
 
        for (i = 0; i < cntr_count; ++i) {
                snd_pcm_format_t format;
@@ -163,7 +163,7 @@ static int test_mux(struct mapper_trial *trial, snd_pcm_access_t access,
        unsigned int bytes_per_sample;
        uint64_t total_frame_count;
        int i;
-       int err;
+       int err = 0;
 
        for (i = 0; i < cntr_count; ++i) {
                snd_pcm_format_t format;