diff mbox

[FFmpeg-devel,2/2] lavf/qsv: suppress code scan complain

Message ID 1527150873-31279-2-git-send-email-zhong.li@intel.com
State Superseded
Headers show

Commit Message

Zhong Li May 24, 2018, 8:34 a.m. UTC
Suppress the complain "variables 'handle' is used but maybe
uninitialized".

Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavfilter/qsvvpp.c             | 7 ++++++-
 libavfilter/vf_deinterlace_qsv.c | 7 ++++++-
 libavfilter/vf_scale_qsv.c       | 7 ++++++-
 3 files changed, 18 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 88c74d8..335b642 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -410,7 +410,7 @@  static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
     AVHWDeviceContext *device_ctx;
     AVQSVDeviceContext *device_hwctx;
     mfxHDL handle;
-    mfxHandleType handle_type;
+    mfxHandleType handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
     mfxVersion ver;
     mfxIMPL impl;
     int ret, i;
@@ -503,6 +503,11 @@  static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
         }
     }
 
+    if (ret != MFX_ERR_NONE) {
+        av_log(avctx, AV_LOG_ERROR, "Error getting the session handle\n");
+        return AVERROR_UNKNOWN;
+    }
+
     /* create a "slave" session with those same properties, to be used for vpp */
     ret = MFXInit(impl, &ver, &s->session);
     if (ret != MFX_ERR_NONE) {
diff --git a/libavfilter/vf_deinterlace_qsv.c b/libavfilter/vf_deinterlace_qsv.c
index c9e76c6..7711089 100644
--- a/libavfilter/vf_deinterlace_qsv.c
+++ b/libavfilter/vf_deinterlace_qsv.c
@@ -178,7 +178,7 @@  static int init_out_session(AVFilterContext *ctx)
     int opaque = !!(hw_frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
 
     mfxHDL handle = NULL;
-    mfxHandleType handle_type;
+    mfxHandleType handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
     mfxVersion ver;
     mfxIMPL impl;
     mfxVideoParam par;
@@ -202,6 +202,11 @@  static int init_out_session(AVFilterContext *ctx)
         }
     }
 
+    if (err != MFX_ERR_NONE) {
+        av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
+        return AVERROR_UNKNOWN;
+    }
+
     /* create a "slave" session with those same properties, to be used for
      * actual deinterlacing */
     err = MFXInit(impl, &ver, &s->session);
diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c
index d118994..1cb3401 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -278,7 +278,7 @@  static int init_out_session(AVFilterContext *ctx)
     int opaque = !!(in_frames_hwctx->frame_type & MFX_MEMTYPE_OPAQUE_FRAME);
 
     mfxHDL handle = NULL;
-    mfxHandleType handle_type;
+    mfxHandleType handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
     mfxVersion ver;
     mfxIMPL impl;
     mfxVideoParam par;
@@ -302,6 +302,11 @@  static int init_out_session(AVFilterContext *ctx)
         }
     }
 
+    if (err != MFX_ERR_NONE) {
+        av_log(ctx, AV_LOG_ERROR, "Error getting the session handle\n");
+        return AVERROR_UNKNOWN;
+    }
+
     /* create a "slave" session with those same properties, to be used for
      * actual scaling */
     err = MFXInit(impl, &ver, &s->session);