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

Submitted by Zhong Li on July 3, 2018, 8:29 a.m.

Details

Message ID 1530606579-17036-1-git-send-email-zhong.li@intel.com
State Accepted
Commit e05e5920a4e1f1f15cc8a7c843159d519f6ec18e
Headers show

Commit Message

Zhong Li July 3, 2018, 8:29 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

Carl Eugen Hoyos July 3, 2018, 8:15 p.m.
2018-07-03 10:29 GMT+02:00, Zhong Li <zhong.li@intel.com>:
> 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(+)
>
> diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
> index 2c01295..7ee1e56 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;

What kind of errors can MFXVideoCORE_GetHandle() return?
Are they unknown?

Carl Eugen
Zhong Li July 4, 2018, 3:40 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Carl Eugen Hoyos

> Sent: Wednesday, July 4, 2018 4:16 AM

> To: FFmpeg development discussions and patches

> <ffmpeg-devel@ffmpeg.org>

> Subject: Re: [FFmpeg-devel] [PATCH V2 1/2] lavf/qsv: suppress code scan

> complain

> 

> 2018-07-03 10:29 GMT+02:00, Zhong Li <zhong.li@intel.com>:

> > 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(+)

> >

> > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c index

> > 2c01295..7ee1e56 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;

> 

> What kind of errors can MFXVideoCORE_GetHandle() return?

> Are they unknown?

> 

> Carl Eugen


May return an error of MFX_ERR_NOT_FOUND, means specified handle type not found.

Patch hide | download patch | download mbox

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 2c01295..7ee1e56 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 c9e76c6..d6b02e9 100644
--- a/libavfilter/vf_deinterlace_qsv.c
+++ b/libavfilter/vf_deinterlace_qsv.c
@@ -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..7d593b2 100644
--- a/libavfilter/vf_scale_qsv.c
+++ b/libavfilter/vf_scale_qsv.c
@@ -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);