]> Git Repo - J-linux.git/commitdiff
selftests: ALSA: Fix fclose on an already fclosed file pointer
authorColin Ian King <[email protected]>
Wed, 12 Jul 2023 14:01:22 +0000 (15:01 +0100)
committerTakashi Iwai <[email protected]>
Thu, 13 Jul 2023 06:08:08 +0000 (08:08 +0200)
In the case where a sysfs file cannot be opened the error return path
fcloses file pointer fpl, however, fpl has already been closed in the
previous stanza. Fix the double fclose by removing it.

Fixes: 10b98a4db11a ("selftests: ALSA: Add test for the 'pcmtest' driver")
Signed-off-by: Colin Ian King <[email protected]>
Reviewed-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
tools/testing/selftests/alsa/test-pcmtest-driver.c

index 71931b240a8396d0a787df552a61f9579cd2c85f..357adc722cbae846657e6f4149447cf71db56ff2 100644 (file)
@@ -47,10 +47,8 @@ static int read_patterns(void)
 
                sprintf(pf, "/sys/kernel/debug/pcmtest/fill_pattern%d", i);
                fp = fopen(pf, "r");
-               if (!fp) {
-                       fclose(fpl);
+               if (!fp)
                        return -1;
-               }
                fread(patterns[i].buf, 1, patterns[i].len, fp);
                fclose(fp);
        }
This page took 0.056703 seconds and 4 git commands to generate.