]> 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:47:39 +0000 (05:47 +0900)
committerJaroslav Kysela <perex@perex.cz>
Tue, 7 May 2019 06:32:53 +0000 (08:32 +0200)
This commit fixes uninitialized return value from a call of test_vector()
to suppress a warning below.

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_vector’:
mapper-test.c:293:6: warning: ‘err’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int err;
      ^~~

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 9f005aad00e4432bef20d88c4a2dde3eff5b649e..3dfcf50ac5257ce8bad252d81cbeba679f4f88bb 100644 (file)
@@ -300,8 +300,10 @@ static int test_vector(struct mapper_trial *trial, snd_pcm_access_t access,
 
        for (i = 0; i < cntr_count; ++i) {
                bufs[i] = malloc(size);
-               if (bufs[i] == NULL)
+               if (bufs[i] == NULL) {
+                       err = -ENOMEM;
                        goto end;
+               }
                memset(bufs[i], 0, size);
        }