* [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer
@ 2023-07-12 14:01 Colin Ian King
2023-07-12 15:53 ` Mark Brown
2023-07-13 6:08 ` Takashi Iwai
0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2023-07-12 14:01 UTC (permalink / raw)
To: Ivan Orlov, Mark Brown, Jaroslav Kysela, Takashi Iwai, Shuah Khan,
alsa-devel, linux-kselftest
Cc: kernel-janitors, linux-kernel
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 <colin.i.king@gmail.com>
---
tools/testing/selftests/alsa/test-pcmtest-driver.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/testing/selftests/alsa/test-pcmtest-driver.c b/tools/testing/selftests/alsa/test-pcmtest-driver.c
index 71931b240a83..357adc722cba 100644
--- a/tools/testing/selftests/alsa/test-pcmtest-driver.c
+++ b/tools/testing/selftests/alsa/test-pcmtest-driver.c
@@ -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);
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer
2023-07-12 14:01 [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer Colin Ian King
@ 2023-07-12 15:53 ` Mark Brown
2023-07-13 6:08 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-07-12 15:53 UTC (permalink / raw)
To: Colin Ian King
Cc: Ivan Orlov, Jaroslav Kysela, Takashi Iwai, Shuah Khan, alsa-devel,
linux-kselftest, kernel-janitors, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
On Wed, Jul 12, 2023 at 03:01:22PM +0100, Colin Ian King wrote:
> 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.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer
2023-07-12 14:01 [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer Colin Ian King
2023-07-12 15:53 ` Mark Brown
@ 2023-07-13 6:08 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2023-07-13 6:08 UTC (permalink / raw)
To: Colin Ian King
Cc: Ivan Orlov, Mark Brown, Jaroslav Kysela, Takashi Iwai, Shuah Khan,
alsa-devel, linux-kselftest, kernel-janitors, linux-kernel
On Wed, 12 Jul 2023 16:01:22 +0200,
Colin Ian King wrote:
>
> 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 <colin.i.king@gmail.com>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-13 6:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 14:01 [PATCH][next] selftests: ALSA: Fix fclose on an already fclosed file pointer Colin Ian King
2023-07-12 15:53 ` Mark Brown
2023-07-13 6:08 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox