From patchwork Thu Jan 12 04:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13097476 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 ABF80C61DB3 for ; Thu, 12 Jan 2023 04:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Owner; bh=6rzkbVy/YDnF2Z2bhC8/+OezJngcH2UhwFZPahpgES8=; b=LQTfd5T76XAuBB/epDOXmh//Pf xtHz/ei2PLmVlTbt3290RiK9GrAmZGJlv7iETNJ/hIEyBqIHdkXLk7pC7T5gSRempQiA9dGMLPTee 8C3RD2viua/hrxAfBNJAOjfyu/FH+MeWRAMkJu1bES+zjLTBXTBbkPHI7lCtzLHWXrHQi1wuhKBDc 6oEQ/3+YYhMvDHSF0+C9e4QFCgycDfcYJXAB/TuPWLoFRs2qko1yg4EvE2rTpJE35JblUV19kttFn /hJw1WLvYxfWCqtGMwbco/PjNoGHabBc5eZYQkldbTwLpZ3VXTJOUqG6Q4dgyI8p4ZTkE4/+CMhOP afmMoH8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFowz-00Deg4-KJ; Thu, 12 Jan 2023 04:12:25 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFoww-00Dedq-5b; Thu, 12 Jan 2023 04:12:23 +0000 X-UUID: 4865a600922f11eda08d4d6090ec5a5c-20230111 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:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=6rzkbVy/YDnF2Z2bhC8/+OezJngcH2UhwFZPahpgES8=; b=MaGt4qGXMiZYB5y4Sgw2LVZFERGs99Y64+0Nh5L55vRw3BVBoxMT/o+rwRWgmSSaijzGE+imYdwu41gyAl7VF5N5/NPRIlqQqhA1yHluDXt5NQRoYgafBQvsihZl2e9vHrM302QY7SgiJl7edOPIcdPga63w5f2egch4xNIGJXE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:f2e428b5-f368-455c-bba7-39ee64b5bd9c,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:543e81c,CLOUDID:3cb1068c-8530-4eff-9f77-222cf6e2895b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0,NGT X-UUID: 4865a600922f11eda08d4d6090ec5a5c-20230111 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1000980586; Wed, 11 Jan 2023 21:12:09 -0700 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Thu, 12 Jan 2023 12:11:48 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 12 Jan 2023 12:11:46 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Tiffany Lin CC: Mauro Carvalho Chehab , Matthias Brugger , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v3,5/7] media: mediatek: vcodec: remove unused lat_buf Date: Thu, 12 Jan 2023 12:11:38 +0800 Message-ID: <20230112041140.833-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230112041140.833-1-yunfei.dong@mediatek.com> References: <20230112041140.833-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230111_201222_221454_3DB81162 X-CRM114-Status: GOOD ( 12.14 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Remove unused lat_buf from core list, or leading to core list access NULL point. Fixes: 365e4ba01df4 ("media: mtk-vcodec: Add work queue for core hardware decode") Signed-off-by: Yunfei Dong --- .../platform/mediatek/vcodec/vdec_msg_queue.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c index ce7c82e38103..cdc539a46cb9 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c @@ -177,7 +177,7 @@ bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue) struct vdec_lat_buf *buf, *tmp; struct list_head *list_core[3]; struct vdec_msg_queue_ctx *core_ctx; - int ret, i, in_core_count = 0; + int ret, i, in_core_count = 0, count = 0; long timeout_jiff; core_ctx = &msg_queue->ctx->dev->msg_queue_core_ctx; @@ -204,8 +204,20 @@ bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue) msg_queue->lat_ctx.ready_num); return true; } - mtk_v4l2_err("failed with lat buf isn't full: %d", - msg_queue->lat_ctx.ready_num); + + spin_lock(&core_ctx->ready_lock); + list_for_each_entry_safe(buf, tmp, &core_ctx->ready_queue, core_list) { + if (buf && buf->ctx == msg_queue->ctx) { + count++; + list_del(&buf->core_list); + } + } + spin_unlock(&core_ctx->ready_lock); + + mtk_v4l2_err("failed with lat buf isn't full: list(%d %d) count:%d", + atomic_read(&msg_queue->lat_list_cnt), + atomic_read(&msg_queue->core_list_cnt), count); + return false; }