lavf/qsv: suppress code scan complain

Message ID 1530606433-16933-1-git-send-email-zhong.li@intel.com
State New
Headers show
Series
  • lavf/qsv: suppress code scan complain
Related show

Commit Message

Li, Zhong July 3, 2018, 8:27 a.m.
Suppress the complain "variables 'handle' is used but maybe
uninitialized".

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

Comments

Luca Barbato July 3, 2018, 9:38 p.m. | #1
On 03/07/2018 10:27, Zhong Li wrote:
> Suppress the complain "variables 'handle' is used but maybe
> uninitialized".
> 

the change seems fine, the commit message probably should be something
along the lines of:

"
qsv: Return early on error

Solve some issues found by an automated code scansion.
"

lu
Li, Zhong July 4, 2018, 5:04 a.m. | #2
Sure. Will update it. Thanks for review.

> -----Original Message-----
> From: libav-devel [mailto:libav-devel-bounces@libav.org] On Behalf Of Luca
> Barbato
> Sent: Wednesday, July 4, 2018 5:39 AM
> To: libav-devel@libav.org
> Subject: Re: [libav-devel] [PATCH] lavf/qsv: suppress code scan complain
> 
> On 03/07/2018 10:27, Zhong Li wrote:
> > Suppress the complain "variables 'handle' is used but maybe
> > uninitialized".
> >
> 
> the change seems fine, the commit message probably should be something
> along the lines of:
> 
> "
> qsv: Return early on error
> 
> Solve some issues found by an automated code scansion.
> "
> 
> lu
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel

Patch

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index f704517..75966b3 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -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 bb26a4d..b659d42 100644
--- a/libavfilter/vf_deinterlace_qsv.c
+++ b/libavfilter/vf_deinterlace_qsv.c
@@ -201,6 +201,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 381844c..e9bfff8 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -300,6 +300,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);