diff mbox series

[FFmpeg-devel] lavc/qsv: refine return value check for MFXQueryIMPL

Message ID 1579596170-24953-1-git-send-email-linjie.fu@intel.com
State New
Headers show
Series [FFmpeg-devel] lavc/qsv: refine return value check for MFXQueryIMPL | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Fu, Linjie Jan. 21, 2020, 8:42 a.m. UTC
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/qsv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index db98c75..563b780 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -391,7 +391,10 @@  int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
         return ret;
     }
 
-    MFXQueryIMPL(qs->session, &impl);
+    ret = MFXQueryIMPL(qs->session, &impl);
+    if (ret < 0)
+        return ff_qsv_print_error(avctx, ret,
+                                  "Error querying the session attributes");
 
     switch (MFX_IMPL_BASETYPE(impl)) {
     case MFX_IMPL_SOFTWARE:
@@ -691,7 +694,7 @@  int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession,
     err = MFXQueryIMPL(parent_session, &impl);
     if (err == MFX_ERR_NONE)
         err = MFXQueryVersion(parent_session, &ver);
-    if (err != MFX_ERR_NONE)
+    else
         return ff_qsv_print_error(avctx, err,
                                   "Error querying the session attributes");