Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10439655rwl; Wed, 11 Jan 2023 20:36:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXug5lvPyuhIX2sGPM3NsSGiglcJYu9iiXExU4kl0e1PVNDbwUjGB+qydGip0FMUdQ8LPsc2 X-Received: by 2002:a05:6a20:7f86:b0:9f:3197:bfa1 with SMTP id d6-20020a056a207f8600b0009f3197bfa1mr8531485pzj.7.1673498182070; Wed, 11 Jan 2023 20:36:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673498182; cv=none; d=google.com; s=arc-20160816; b=SiZnelGgexp2JBM0sEhZoCf0X8jPxWYocCzkCSd3tw1yk20VMUb3LcanAWG9YQWlhZ pRRTiYtX1kH4GZ1Tb/LF+ImF3ZkSVlSi/U7mi+Nu3i0xoCZIqyBnFkWAEOsyyYC6RO9/ 5IE6BAhI6LYKe1n+g/SI13ozy2I5B8ZoXn09BR6Q/vBLHdNr+pEAO9IBtruvd8MWemXp ZyttJ4YrtONTxNwkO5CZaV99XBpnn3N3Ygwh3rjWGCQsjlZEUvOHhWuMm3IgF475ASqq bPZPlKf5PQLUkBIMbCB7rdUlkh87LwWreGrhcnwQ2O3pVlmRD/axD6aLf7Ogr5cGxLBT hZeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6rzkbVy/YDnF2Z2bhC8/+OezJngcH2UhwFZPahpgES8=; b=DZCi8bDGg9TiXFe0d6Bw+ZlrvibmTpvC2u+x1KETNvnHlVRaZxqomQllwWOyvogqRF 4bmuyZaq7z4a8hhsZenTjUJYIpf3IoslGZkIkr+wZSxt+7WEKS5qGKphmHSX4A0ZucZp TiwynWEx2+FdMw9sUzwqCYIf8SKVK6NWiHEKOVohav4dVy5Ze3wzxD0bEeoIJqysBimk AOXSb18UYkYO1ajOWbYHsi8ArIZQ1FawCPhA9adyJuIiyNriTrW+NAnZaLm0VtkSVNkl TsP2Tj4Rv8GUQP660gL2OMCHY+SSfut/ckv9uYJvBpbYj5GRv8ZiIdEYQ3u1CcvoOhl9 j49A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=MaGt4qGX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k20-20020a63d854000000b0047907294d38si16854547pgj.427.2023.01.11.20.36.14; Wed, 11 Jan 2023 20:36:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=MaGt4qGX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235975AbjALEMs (ORCPT + 50 others); Wed, 11 Jan 2023 23:12:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231458AbjALEL7 (ORCPT ); Wed, 11 Jan 2023 23:11:59 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC0784C729; Wed, 11 Jan 2023 20:11:53 -0800 (PST) X-UUID: 3c8312be922f11eda06fc9ecc4dadd91-20230112 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:331ee35e-62c6-4b8d-80e6-8d212ccefa63,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.17,REQID:331ee35e-62c6-4b8d-80e6-8d212ccefa63,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:543e81c,CLOUDID:a98295f5-ff42-4fb0-b929-626456a83c14,B ulkID:230112121150RAS22AU2,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0 X-CID-APTURL: Status:success,Category:nil,Trust:0,Unknown:0,Malicious:0 X-CID-BVR: 0,NGT X-UUID: 3c8312be922f11eda06fc9ecc4dadd91-20230112 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 332061807; Thu, 12 Jan 2023 12:11:49 +0800 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; } -- 2.18.0