Commit 645e583d authored by Colin Ian King's avatar Colin Ian King Committed by Takashi Iwai

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: 10b98a4d ("selftests: ALSA: Add test for the 'pcmtest' driver")
Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
Reviewed-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230712140122.457206-1-colin.i.king@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 35bc3efb
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment