diff mbox series

[FFmpeg-devel,7/7] avcodec/adpcmenc: remove gotos and error label

Message ID 1590674250-32571-7-git-send-email-lance.lmwang@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,1/7] avcodec/h264dec: cosmetics | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Lance Wang May 28, 2020, 1:57 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/adpcmenc.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index bcb6783..52f0f67 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -65,7 +65,6 @@  static av_cold int adpcm_encode_init(AVCodecContext *avctx)
     ADPCMEncodeContext *s = avctx->priv_data;
     uint8_t *extradata;
     int i;
-    int ret = AVERROR(ENOMEM);
 
     if (avctx->channels > 2) {
         av_log(avctx, AV_LOG_ERROR, "only stereo or mono is supported\n");
@@ -120,7 +119,7 @@  static av_cold int adpcm_encode_init(AVCodecContext *avctx)
         avctx->bits_per_coded_sample = 4;
         avctx->block_align    = BLKSIZE;
         if (!(avctx->extradata = av_malloc(32 + AV_INPUT_BUFFER_PADDING_SIZE)))
-            goto error;
+            return AVERROR(ENOMEM);
         avctx->extradata_size = 32;
         extradata = avctx->extradata;
         bytestream_put_le16(&extradata, avctx->frame_size);
@@ -140,8 +139,7 @@  static av_cold int adpcm_encode_init(AVCodecContext *avctx)
             avctx->sample_rate != 44100) {
             av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, "
                    "22050 or 44100\n");
-            ret = AVERROR(EINVAL);
-            goto error;
+            return AVERROR(EINVAL);
         }
         avctx->frame_size = 512 * (avctx->sample_rate / 11025);
         break;
@@ -150,13 +148,10 @@  static av_cold int adpcm_encode_init(AVCodecContext *avctx)
         avctx->block_align = BLKSIZE;
         break;
     default:
-        ret = AVERROR(EINVAL);
-        goto error;
+        return AVERROR(EINVAL);
     }
 
     return 0;
-error:
-    return ret;
 }
 
 static av_cold int adpcm_encode_close(AVCodecContext *avctx)
@@ -725,8 +720,6 @@  static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     avpkt->size = pkt_size;
     *got_packet_ptr = 1;
     return 0;
-error:
-    return AVERROR(ENOMEM);
 }
 
 static const enum AVSampleFormat sample_fmts[] = {