From patchwork Mon Apr 17 12:44:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13213821 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91C5EC77B70 for ; Mon, 17 Apr 2023 12:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Cc:To:From: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fpZQyWXZv1SGvHMAsf/C6+mgHGstYIKKvbsIaTp56kg=; b=YXQEDszzQSifzx iPettplb3bAFSEvEmgDrgY4tzEJvtUqbu5Ph+pCFHUdp1FLKilNCvCq3qhGmJAYrdBCDLEgjbIBGO auJb1Teu2qNZroxBhqhDXcbIK3sfJBu9ZniWKo2ppvszNYK/oPFk55f3pzwwLy7InY0/UBurasUgd kVBRaRkkr5ykdJmJMJ80FgBoR9QWcvHqzxIkRxtsDy0zCkxt2Fxk57O6WB2GdOJXN9ZlENu1ncNfu JeHFFFfsJMtorFfJof+0TJCSWTEH9+c1Fh6imOxHevLxGe7evKjc7I1u8jj6eVWcFGV6cmRwWBApv p3P0nlt5IOQ0XNs25oeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1poODn-00GBji-0c; Mon, 17 Apr 2023 12:44:39 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1poODj-00GBiC-32; Mon, 17 Apr 2023 12:44:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1681735456; i=markus.elfring@web.de; bh=qDbD7coCJdS/2vghLIEPg9MEuMfbhlibiv4/QKu/6Ko=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=KEjOgP7eoC1d5PY6UHjH1inXCHIIDZLUn/kLNZRyKkntwWD2tiVRU60xuD2DIpdOV yY5871reCDzSeViBoG7BQ+JOSZC6HgiYTOGfy54QUF3fztBcQAJ/mSsG+5QK8XgL5m tdAT7alHVL99YMva8SIOzkxgo5qVGYGZmXm8zdDyX5MT3mdCy450IcfMQxLlBZ6su9 PkJb8o8tKK9d5E0f9pLnlyFt3g+CAjGdb3KcvVpOzlqdWit+AacQoq1OGX7K1sv5X4 csF/On+W6fvLyD8p20o9+0AADmvIV/UVK9qehvLbimc7cM5FjX5Bl16BpcUSLbf5BM e0sjeD/2hKugA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.85.83]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MPrPT-1q1ucW3HwR-00Mp6E; Mon, 17 Apr 2023 14:44:15 +0200 Message-ID: <4a357fbe-4f9d-37d1-0be1-93ca754698e9@web.de> Date: Mon, 17 Apr 2023 14:44:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: [PATCH 2/2] media: mediatek: vcodec: Move variable assignments behind null pointer checks in vdec_vp9_slice_single_decode() Content-Language: en-GB From: Markus Elfring To: Hans Verkuil , kernel-janitors@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, Andrew-CT Chen , AngeloGioacchino Del Regno , Ezequiel Garcia , Guo Zhengkui , Haowen Bai , Matthias Brugger , Mauro Carvalho Chehab , Mingjia Zhang , Tiffany Lin , Xiaoyong Lu , Yunfei Dong Cc: cocci@inria.fr, LKML References: <40c60719-4bfe-b1a4-ead7-724b84637f55@web.de> <1a11455f-ab57-dce0-1677-6beb8492a257@web.de> <0341924c-7f0a-28aa-eeae-f7de69ab36d8@xs4all.nl> <1d945069-00d3-7d9e-b783-96c368ff114b@web.de> In-Reply-To: <1d945069-00d3-7d9e-b783-96c368ff114b@web.de> X-Provags-ID: V03:K1:6QuD1QlYQUklTPHI55F/pOJ74eoA08cFgoFR3pUXzqg7KkqkCGb vfSW0TZWJeguxYecDytyW8/z9+6AUkN6oXtchooluTt+S62j3IV+JyC86VDiFE65xtZa2Gh /68nhN6TfWRwWLTxgyzzmYPFt8D9Xlpyz2VTQlorBP/oo9rMUQTkqlkDuQ+26YtK0P6839A A1eAkYZIagDBFkTfXKAQA== UI-OutboundReport: notjunk:1;M01:P0:CWNCASpe+a4=;1DRkwAqrwvRiACXmvTDeqvXjEmi oqdABA8YJZc/XMyY9mcjY4XPxroiRBLH/w3MpNK1GXPH8Sp/x/rSGZahYZm7U7Ry5c6d2YpYw GLC4ixDQ1QLfWFvzW6OtTHRmE/Dg5VjbocNbkIvuYprq50ytv7PlzMm07j7CrBMRtK9DQ9gAi T5Y4B1k5BHfTihy7o2w6NvdAIAe3nxOwBnR5aUgQjEWLFubluPSthoM4bvO1WLaaLzNKyJN5+ Opg3KtWSABK5gvA35jorZ1SVmjXrlLn9pFJuEFmOQL20xydpD6wZlVXrKiOlJvR59+Nv/k949 FhUtFYk6ij26La5xnOtnmLufrFWedksMGmOWDnmcoERfxvV4ObCaxm6Rx1huSnKTskEecso2G aNARatVRcVXOoIu15lSHBNF6pxAkctxLcbJzkkTL4Gb8vW30KVZ7eYM2Mi72E8IrTAdfQcgYC YohrIDyOvpYvkYbYj8Q3wF4pOrfb4QUDxAzICihFVXFQGo0CPoaAcRdaiJfo6SAf/KEhEd3Wr xsTaLG47SyU8PbszIs2cFP8kPJsZAuvuk/ZNimp3yIWgNLcXi7ifM/kkFYHZ29M1RyPf2YKm/ K9TI71NA/iOFeGwPM+FL3Odn7EAUvsNj4bU1JgyHhhsbiazpT2NlqbAaxG3LDpYCRwF4PWXjo kk8naRv50fhphndGuElqL+ueTy56Fyw2xvkNnUXAMxhmkF879Bbey8JowItOV2B0ImhHqF4YO 4Y1Bc0ANxy2d5q3Oewcr3+VSgM6h4msR4ayU+4jF8v1QbOxtBsrm4Rf7XHOsjOfSgB4pGtfkJ W4fFeUbInMnkj/H/YOVLxHvLW1rDW5ph8K4aTzZJcFyAWzrMNGuack9PIFNMW7KBAun9ZlxeJ lJ0eDPbY0nKn07JGThVfwaCKRewgIGmRh5F5gUESYo6rquJ0jhkT2o7xnimnS1U70JSWPYO08 ooWviw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230417_054436_271076_857705A6 X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Date: Mon, 17 Apr 2023 14:19:13 +0200 The addresses which were assigned to the variables “instance”, “pfc” and “ctx” would not be used if a null pointer was passed by the input parameter “bs”. Thus move these assignments behind corresponding pointer checks. Signed-off-by: Markus Elfring --- .../platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.40.0 diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c index 8430098ed0b1..562fe07d3731 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c @@ -1989,22 +1989,23 @@ static int vdec_vp9_slice_get_param(void *h_vdec, enum vdec_get_param_type type, static int vdec_vp9_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs, struct vdec_fb *fb, bool *res_chg) { - struct vdec_vp9_slice_instance *instance = h_vdec; - struct vdec_vp9_slice_pfc *pfc = &instance->sc_pfc; + struct vdec_vp9_slice_instance *instance; + struct vdec_vp9_slice_pfc *pfc; struct vdec_vp9_slice_vsi *vsi; struct mtk_vcodec_ctx *ctx; int ret; - ctx = instance->ctx; - /* bs NULL means flush decoder */ if (!bs) return vdec_vp9_slice_flush(h_vdec, bs, fb, res_chg); + instance = h_vdec; + ctx = instance->ctx; fb = ctx->dev->vdec_pdata->get_cap_buffer(ctx); if (!fb) return -EBUSY; + pfc = &instance->sc_pfc; vsi = &pfc->vsi; ret = vdec_vp9_slice_setup_single(instance, bs, fb, pfc);