diff mbox series

[FFmpeg-devel,1/2] avutil/tx: remove deadcode of the control flow

Message ID 20220128020818.39850-1-lq@chinaffmpeg.org
State Accepted
Commit f0044d886f0e02789976b786b9cc85c4dffa4da7
Headers show
Series [FFmpeg-devel,1/2] avutil/tx: remove deadcode of the control flow | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished

Commit Message

Liu Steven Jan. 28, 2022, 2:08 a.m. UTC
From: Steven Liu <liuqi05@kuaishou.com>

Fix CID: 1497864
The control flow should return ENOSYS if nb_cd_matches is 0 at before
and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
control flow if (ret >= 0) before end label.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
---
 libavutil/tx.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Lynne Jan. 28, 2022, 7:07 a.m. UTC | #1
28 Jan 2022, 03:08 by lq@chinaffmpeg.org:

> From: Steven Liu <liuqi05@kuaishou.com>
>
> Fix CID: 1497864
> The control flow should return ENOSYS if nb_cd_matches is 0 at before
> and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
> control flow if (ret >= 0) before end label.
>
> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
> ---
>  libavutil/tx.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/libavutil/tx.c b/libavutil/tx.c
> index 2897f3bd35..50616adba7 100644
> --- a/libavutil/tx.c
> +++ b/libavutil/tx.c
> @@ -601,9 +601,6 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
>  
>  av_free(sub);
>  
> -    if (ret >= 0)
> -        ret = AVERROR(ENOSYS);
> -
>  end:
>  av_free(cd_matches);
>  return ret;
>

Sorry, neither of those is correct.
I'll push my own.
Lynne Jan. 28, 2022, 7:30 a.m. UTC | #2
28 Jan 2022, 08:07 by dev@lynne.ee:

> 28 Jan 2022, 03:08 by lq@chinaffmpeg.org:
>
>> From: Steven Liu <liuqi05@kuaishou.com>
>>
>> Fix CID: 1497864
>> The control flow should return ENOSYS if nb_cd_matches is 0 at before
>> and the ret equal AVERROR(ENOMEM) or goto end label, so remove the last
>> control flow if (ret >= 0) before end label.
>>
>> Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
>> ---
>>  libavutil/tx.c | 3 ---
>>  1 file changed, 3 deletions(-)
>>
>> diff --git a/libavutil/tx.c b/libavutil/tx.c
>> index 2897f3bd35..50616adba7 100644
>> --- a/libavutil/tx.c
>> +++ b/libavutil/tx.c
>> @@ -601,9 +601,6 @@ av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
>>  
>>  av_free(sub);
>>  
>> -    if (ret >= 0)
>> -        ret = AVERROR(ENOSYS);
>> -
>>  end:
>>  av_free(cd_matches);
>>  return ret;
>>
>
> Sorry, neither of those is correct.
> I'll push my own.
>

Had been thinking about eliminating context allocations if
the codelet requires no context, but I decided it's too much trouble.
Pushed both as-is, with some minor change on the malloc test.
Thanks. I should get Coverity access too some day.
diff mbox series

Patch

diff --git a/libavutil/tx.c b/libavutil/tx.c
index 2897f3bd35..50616adba7 100644
--- a/libavutil/tx.c
+++ b/libavutil/tx.c
@@ -601,9 +601,6 @@  av_cold int ff_tx_init_subtx(AVTXContext *s, enum AVTXType type,
 
     av_free(sub);
 
-    if (ret >= 0)
-        ret = AVERROR(ENOSYS);
-
 end:
     av_free(cd_matches);
     return ret;