diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 8fce605f6e08311c93bc3e3c33173e30a840f938..9f454474b27a7e22d21ee48954b5311aff5293f5 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -653,9 +653,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
     }
 
     ret= av_get_packet(s->pb, pkt, size);
-    if (ret < 0) {
-        return AVERROR(EIO);
-    }
+    if (ret < 0)
+        return ret;
     pkt->dts = dts;
     pkt->pts = pts == AV_NOPTS_VALUE ? dts : pts;
     pkt->stream_index = st->index;