From patchwork Thu Mar 21 01:47:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 13598300 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 E1523C54E58 for ; Thu, 21 Mar 2024 01:48:25 +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:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PY2JqmEtyHYuHYDmK0nOqyb/ffiulG2+mG+QhIs6eNs=; b=fsdYKjNB+Mh+e0 pw09p/TgZFefIgfpACBuxKRErUZsLgwHFVSIFgJTnPxu7B54Wh/VGVn6b47226Py530n1KeJQqXr7 jRQyH1X1sVVyDp3q5SIKhS7zECQHeay3nYJ7ZXAX5S4wInQYAkJoTQNp8+L0vhZnYY5SrPmvWRNXq bGymFbSNlJaR5u6c4xfscwzPLPYt39gVHCOU2CTaz0FBS+pledOsqdg5BxQJai8AuarOxL6ZA2e3X AZxAsFWSr0uNdqCaErFfSgxVeBYtQ8jKdgsRDb2fnI8m6UjwckZFzED6KYX3yE3GpX8zM+G1Gb1No hRixZtlfwK0aOp8rNIHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rn7XM-00000001TCP-2Kxg; Thu, 21 Mar 2024 01:48:08 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rn7XI-00000001TBM-1gtV; Thu, 21 Mar 2024 01:48:06 +0000 X-UUID: 0c4e82e4e72511ee9aa9374d6d45775a-20240320 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=dEJZ0X1McOPizF7jgy7/EKKAk82UfoRmWloVvTbNFTk=; b=DIUPw6kTIba+q9ODt3PDHGkTQ5zpWu0UGc1iiO0y87TghYNUqHjqYJS5RZttyExewN9mwzgxUU+onYNISlIXb8UF4bG/57GQP50Tpa7cTXmP0IE4lyRwq4gQyj7ISTaJOcLIYvCauFXi6Y6sqDYsUG3bQEmQ0oySOTSr71xMTzw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:75514bf4-42bf-4486-9c82-4e5dd9b7f542,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:6f543d0,CLOUDID:0c5da590-e2c0-40b0-a8fe-7c7e47299109,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES :1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 0c4e82e4e72511ee9aa9374d6d45775a-20240320 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1439545780; Wed, 20 Mar 2024 18:48:00 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 21 Mar 2024 09:47:56 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 21 Mar 2024 09:47:55 +0800 From: Irui Wang To: Hans Verkuil , Mauro Carvalho Chehab , Matthias Brugger , Yunfei Dong , , , CC: Longfei Wang , Maoguang Meng , Irui Wang , , , , , Subject: [PATCH v2] media: mediatek: vcodec: Handle invalid decoder vsi Date: Thu, 21 Mar 2024 09:47:54 +0800 Message-ID: <20240321014754.6540-1-irui.wang@mediatek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--4.032200-8.000000 X-TMASE-MatchedRID: vl5QM0vd8N2rSedjouq7Z7MjW/sniEQKMZm0+sEE9mv7efdnqtsaE7x1 VMA+w2Qu/mRejmnKqNv182FRWwrycVxxDx5qbkR9FEUknJ/kEl7dB/CxWTRRuwihQpoXbuXFgfV e2TOg2R0Kzm808vZggmNkwsaDLShPAZFwQlvysNQPhbT9/Y4bTXE4Dm8YPvFzQapnAAOBflb/DA 3T/JDd9AtMf/rFuFCcaaeeX2Q5bK9+HGPweyal2mGdUezV59DHQZpgl3CshRSeqD9WtJkSIw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.032200-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 9001B387118349F518ECCC3A1D208436A392DE5B2B2515818146CE89C0D88BDC2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240320_184804_735699_40625DD3 X-CRM114-Status: UNSURE ( 9.37 ) 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 Handle invalid decoder vsi in vpu_dec_init to ensure the decoder vsi is valid for future use. Fixes: 590577a4e525 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver") Signed-off-by: Irui Wang Reviewed-by: AngeloGioacchino Del Regno --- changed with v1: - add Fixes tag --- .../media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c index 82e57ae983d5..17770993fe5a 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c @@ -231,6 +231,12 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu) mtk_vdec_debug(vpu->ctx, "vdec_inst=%p", vpu); err = vcodec_vpu_send_msg(vpu, (void *)&msg, sizeof(msg)); + + if (IS_ERR_OR_NULL(vpu->vsi)) { + mtk_vdec_err(vpu->ctx, "invalid vdec vsi, status=%d", err); + return -EINVAL; + } + mtk_vdec_debug(vpu->ctx, "- ret=%d", err); return err; }