From patchwork Mon Dec 19 06:43:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 34424 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp2238387wrn; Sun, 18 Dec 2022 23:09:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXvEAsENyGuzf17y26Zioe4u8hi9I/6ZWjPTfX2fUXcr5xH92pEcHGQelNHfWgS9fWsWc5CC X-Received: by 2002:a17:907:c784:b0:81f:fc05:2ba0 with SMTP id tz4-20020a170907c78400b0081ffc052ba0mr3072063ejc.2.1671433766436; Sun, 18 Dec 2022 23:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671433766; cv=none; d=google.com; s=arc-20160816; b=S3pLDIJiN5pXmc+y2rXRijQCPmq4jU+LZr41gpxYH7z5KnFvC4nSxLg25mjN1mBP3N mZ/8zz6bZO6YhCXptJJBBAfyR4C6F15cu7vLarHrU49bMSPL4qxdkBv8kWFjK3i2ynTO 59/ZkZJmhBzoSEzQWfYB9ri3Rwbegh2oxBGbJsrMIoDQhEWi8KuSBZpSgMx4ENTQjwkC 9+RlIp8tY2n13hrnf6/VO6NpRn/8Zke8LmFqr+8aqW8t4tu3zcbx7dNzaKI9Xp1AahDo MMkeffUDrvKdcjEfMZAa8S1qCwhxaQ/HAbvH89wW69qQ0gZjmvSQrT6eLH/wxc4viXZQ qsRw== 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=P2ZJeTn5XLvD+TEHi19A45Pkq0m/Bq/uD/MUJB/dX/0=; b=oKoVGUSwiYcDWezrVqbOcZmaVSfcnVm7EIvnugVNX6QjyyU4zGZRmoA2nJE37q0NXn Jbu/mhQHKqMnMojWYWS/XTczwaRLu0laiMsfEouXJhc+1gw043Go3Qhji1E+3mOOgjdi 9O3YQrlVqpKXgpXPD0NL4PmJGxhPGGy9pPk21QR2SYnwte2ZIw2zqkT1um65jAyR71Um ldJsLT5RG0aT2HZQzHp4upMqBZ0EJGG9fW07tLg4dgtBs2YjatP1HrbrqN+z2r9VMm8B gSwFR+/heu+gNtTW5+JFB9uS/W7TpDJne+SJiuZ0SCEY5liCxi/HlPRfhEKCzSuTB0aL a49w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=ApZ1iUlp; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb37-20020a1709071ca500b0079bf804c0c4si8319648ejc.103.2022.12.18.23.09.02; Sun, 18 Dec 2022 23:09:26 -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=ApZ1iUlp; 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 S231668AbiLSGp0 (ORCPT + 99 others); Mon, 19 Dec 2022 01:45:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231540AbiLSGoq (ORCPT ); Mon, 19 Dec 2022 01:44:46 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3931995A2; Sun, 18 Dec 2022 22:43:49 -0800 (PST) X-UUID: 50a2f16fbf7c45b087ccf150ee5afdfa-20221219 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=P2ZJeTn5XLvD+TEHi19A45Pkq0m/Bq/uD/MUJB/dX/0=; b=ApZ1iUlp3Ax+IK2fNfvqG3DTCJCdpn6mEmhkeBoyi6/JxYBsujbhXYnBEA+zxrOqq1tJyPjDDFcFSJenTG4/pgWlTaOxEBWfX/ZwdW2B2c9uqU6dMLqUX7I7gVOUAeLpgGIf/XTq8b8DezhJTSGwxSwsF8+9Qp+/P7aXzJPwt8A=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:6de892c0-88f9-49d9-a8bd-458a43fc231a,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:dcaaed0,CLOUDID:4fa3bc89-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 X-UUID: 50a2f16fbf7c45b087ccf150ee5afdfa-20221219 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 962585694; Mon, 19 Dec 2022 14:43:44 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 19 Dec 2022 14:43:43 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 19 Dec 2022 14:43:42 +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 v2,5/7] media: mediatek: vcodec: remove unused lat_buf Date: Mon, 19 Dec 2022 14:43:30 +0800 Message-ID: <20221219064332.2124-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219064332.2124-1-yunfei.dong@mediatek.com> References: <20221219064332.2124-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752625333283114071?= X-GMAIL-MSGID: =?utf-8?q?1752625333283114071?= 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 Reviewed-by: AngeloGioacchino Del Regno --- .../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 1491796f7d39..0255b8385bfc 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 vdec_msg_queue_ctx *core_ctx; long timeout_jiff; - int ret; + int ret, count = 0; core_ctx = &msg_queue->ctx->dev->msg_queue_core_ctx; spin_lock(&core_ctx->ready_lock); @@ -199,8 +199,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; }