Skip to content

Commit 645e583

Browse files
ColinIanKingtiwai
authored andcommitted
selftests: ALSA: Fix fclose on an already fclosed file pointer
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: 10b98a4 ("selftests: ALSA: Add test for the 'pcmtest' driver") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230712140122.457206-1-colin.i.king@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 35bc3ef commit 645e583

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

tools/testing/selftests/alsa/test-pcmtest-driver.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ static int read_patterns(void)
4747

4848
sprintf(pf, "/sys/kernel/debug/pcmtest/fill_pattern%d", i);
4949
fp = fopen(pf, "r");
50-
if (!fp) {
51-
fclose(fpl);
50+
if (!fp)
5251
return -1;
53-
}
5452
fread(patterns[i].buf, 1, patterns[i].len, fp);
5553
fclose(fp);
5654
}

0 commit comments

Comments
 (0)