From patchwork Tue Jan 21 08:42:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 17447 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id CFD6F448ABD for ; Tue, 21 Jan 2020 10:43:54 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA4F168AF50; Tue, 21 Jan 2020 10:43:54 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4614768AA35 for ; Tue, 21 Jan 2020 10:43:48 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 00:43:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,345,1574150400"; d="scan'208";a="215464954" Received: from icl-dev.sh.intel.com ([10.239.158.73]) by orsmga007.jf.intel.com with ESMTP; 21 Jan 2020 00:43:45 -0800 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 Jan 2020 16:42:50 +0800 Message-Id: <1579596170-24953-1-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH] lavc/qsv: refine return value check for MFXQueryIMPL X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Linjie Fu --- libavcodec/qsv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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");