diff mbox series

[FFmpeg-devel] tests/checkasm: Remove check on linux perf fd in uninit

Message ID tencent_DF756AFA7D8EACDE38BDC0E9B73468E2000A@qq.com
State New
Headers show
Series [FFmpeg-devel] tests/checkasm: Remove check on linux perf fd in uninit | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili June 12, 2024, 5:35 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

The check should be >= 0, not > 0. The check itself is redundant
since uninit only being called after init is success.
---
 tests/checkasm/checkasm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Shiqi Zhu June 13, 2024, 2:04 a.m. UTC | #1
On Thu, 13 Jun 2024 at 01:36, Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> From: Zhao Zhili <zhilizhao@tencent.com>
>
> The check should be >= 0, not > 0. The check itself is redundant
> since uninit only being called after init is success.
> ---
>  tests/checkasm/checkasm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index 28237b4d25..bbcc90f91f 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -814,8 +814,7 @@ static int bench_init(void)
>  static void bench_uninit(void)
>  {
>  #if CONFIG_LINUX_PERF
> -    if (state.sysfd > 0)
> -        close(state.sysfd);
> +    close(state.sysfd);

Is this better?

if (state.sysfd >= 0) {
    close(state.sysfd);
    state.sysfd = -1;
}

>  #endif
>  }
>
> --
> 2.42.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Zhao Zhili June 13, 2024, 12:21 p.m. UTC | #2
> On Jun 13, 2024, at 10:04, Shiqi Zhu <hiccupzhu@gmail.com> wrote:
> 
> On Thu, 13 Jun 2024 at 01:36, Zhao Zhili <quinkblack@foxmail.com <mailto:quinkblack@foxmail.com>> wrote:
>> 
>> From: Zhao Zhili <zhilizhao@tencent.com>
>> 
>> The check should be >= 0, not > 0. The check itself is redundant
>> since uninit only being called after init is success.
>> ---
>> tests/checkasm/checkasm.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>> 
>> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
>> index 28237b4d25..bbcc90f91f 100644
>> --- a/tests/checkasm/checkasm.c
>> +++ b/tests/checkasm/checkasm.c
>> @@ -814,8 +814,7 @@ static int bench_init(void)
>> static void bench_uninit(void)
>> {
>> #if CONFIG_LINUX_PERF
>> -    if (state.sysfd > 0)
>> -        close(state.sysfd);
>> +    close(state.sysfd);
> 
> Is this better?
> 
> if (state.sysfd >= 0) {
>    close(state.sysfd);
>    state.sysfd = -1;
> }

I don’t think there is a requirement on reentrancy in this case.

> 
>> #endif
>> }
>> 
>> --
>> 2.42.0
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org <mailto:ffmpeg-devel-request@ffmpeg.org> with subject "unsubscribe".
diff mbox series

Patch

diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 28237b4d25..bbcc90f91f 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -814,8 +814,7 @@  static int bench_init(void)
 static void bench_uninit(void)
 {
 #if CONFIG_LINUX_PERF
-    if (state.sysfd > 0)
-        close(state.sysfd);
+    close(state.sysfd);
 #endif
 }