From patchwork Mon Nov 13 12:26:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 164449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1168166vqg; Mon, 13 Nov 2023 04:32:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaSmPM10jLZx4XTkDNjlKQeFxBktxejGa8kCIlZvnDpn+sjLJKiv0ivatgxVbMX4IzqfuE X-Received: by 2002:a05:6a21:1a2:b0:186:7842:ad1a with SMTP id le34-20020a056a2101a200b001867842ad1amr2606029pzb.16.1699878776198; Mon, 13 Nov 2023 04:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699878776; cv=none; d=google.com; s=arc-20160816; b=qDHI5v9odzYsfCrdGIyZkjbhh37qvZO2UTUPnZG5F+3+/xNDdrBnv9vnDSs5RD3NLY ouf7sQP1UOKzvMtF32dXJQ36NDKpOeDNk1jXTCIbBiv3U0J6uAPUMggXgL9XjdXjDRi3 SvRRBRBgQx7p5GVnO/rhhVzvhz/m3kAryBj9OGBbpIp/LkXOrQQlLiwedhykWsyCV0FB +1oQZkbq6CTQ0dzi39WZLOry147/JAw0qqwz8S4nJAdIirr8qF3zsGbBgMlVefYGffnS IewAsmFXk3HOYlb/7DxLfVidinzY1KaNvpPNwcHYLkOu2MqOcjBPmTKsjbxF3N1CNTLT IznA== 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=KmCcZKWWwZWAAIdygGTS4bHPElBN0IgCDYBXIzaN8Rc=; fh=7on1fDOo+7RRG3zRqFvurM7lMoegCj1W5YwuRhKB6lQ=; b=B3ZEl6bigoLHAicYjjBip2wyRzfayZi2faCA07nmNYwFlroa+H+RGET149TdRz29qF GfdfZ1vETl4jB+76BTqUWdN+Mn2/aYeD3OE9mLSiayRpCO9CNI/7TH1Z4+CUJsEfRl/O wiQjxWlcYXZobS8c0onU5MNBFbLaC1N/ebtqEvMG1ytGmc2wNNxufXHFINZPgLUM/TU7 qX8t7k3wEl1tNdJegsgUEC35hLDMnnf6SJvaeMNy7zwQSeNJbJtL0liGpe30yvBvjLcH DWFaK8G1ZVBA8Cwk2HdDOdj2SWQ26OiH6tdxouaIocWGTMw+2Mn7VyKQlIuUsdHqpFjd NkKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aNqurdmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id z2-20020a056a00240200b0069100706960si5632656pfh.116.2023.11.13.04.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aNqurdmg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3631280A13BE; Mon, 13 Nov 2023 04:32:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbjKMMcN (ORCPT + 29 others); Mon, 13 Nov 2023 07:32:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjKMMcJ (ORCPT ); Mon, 13 Nov 2023 07:32:09 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9F61711 for ; Mon, 13 Nov 2023 04:32:06 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cc7077d34aso30899765ad.2 for ; Mon, 13 Nov 2023 04:32:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699878726; x=1700483526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KmCcZKWWwZWAAIdygGTS4bHPElBN0IgCDYBXIzaN8Rc=; b=aNqurdmgkmGfuTxNJqmnOfJzRGVyYlqIYJzI3BT9KeFCTY/OXqpWPtO7wNXec5Owqe S65pP9bTUWWCs3E25V/7nY7x426+S/fXBwhZ/RiTXAo58SemfLLTbz8Q7qmq9cWfIo0n 2zGVAkaCUSuYFITm2nvbrgNMvNxcZqJIPtwTE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699878726; x=1700483526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KmCcZKWWwZWAAIdygGTS4bHPElBN0IgCDYBXIzaN8Rc=; b=J0nBi7hTghmCDcnG9dPUPxS1WNJMHjEdwaYbPJZ26oijibkTFgta7m80m++tPI95c8 x8yV1TSwIGz/9PJlXD6ik2C+s9Q5lixvSH3++OGrK2NZG5uD/VuhOlICXunb2Ta7BWtU 5pjTThLvi9dXwZwpb/YkTgOdv7UtcYWxyGI5tl7fJL+NkIBGnRZHZ9cyiPUAxTVkW135 QpFWywnuNDVZDfKQxmY9S+XAM3R/bfhdeFRRM4ZOfr5oSX8JhGXiBTRLnlPCE9Z8Q989 /OYdeMS9HXZyOhIEmKX0dX+a2T/Sah7vzeMXjMTAFGxOG7iablwXzGm5BkQQoPh4L+cs wPMA== X-Gm-Message-State: AOJu0YwED1nfietMEGUKhUsEigdWu02za/IwK5C5Y+xUcT7LkgAYSfT5 3wNq6gTTVYQRaf+8kKxkDa+t8w== X-Received: by 2002:a17:903:1c4:b0:1cc:3fc9:1802 with SMTP id e4-20020a17090301c400b001cc3fc91802mr4826133plh.61.1699878725604; Mon, 13 Nov 2023 04:32:05 -0800 (PST) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:bc9:4777:173:8be3]) by smtp.gmail.com with ESMTPSA id e12-20020a170902d38c00b001bde65894c8sm3924104pld.268.2023.11.13.04.32.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:05 -0800 (PST) From: Fei Shao To: Hans Verkuil , AngeloGioacchino Del Regno Cc: Fei Shao , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Dufresne , =?utf-8?b?TsOtY29sYXMg?= =?utf-8?b?Ri4gUi4gQS4gUHJhZG8=?= , Tiffany Lin , Yunfei Dong , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 1/4] media: mediatek: vcodec: Replace dev_name in error string Date: Mon, 13 Nov 2023 20:26:49 +0800 Message-ID: <20231113123049.4117280-2-fshao@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231113123049.4117280-1-fshao@chromium.org> References: <20231113123049.4117280-1-fshao@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 13 Nov 2023 04:32:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782452087500874244 X-GMAIL-MSGID: 1782452087500874244 mtk_v4l2_err() already uses dev_err(), so don't print the device name again. Print function name instead. Signed-off-by: Fei Shao Reviewed-by: AngeloGioacchino Del Regno --- .../media/platform/mediatek/vcodec/common/mtk_vcodec_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c index 9ce34a3b5ee6..ea8c35c0e667 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c @@ -67,7 +67,7 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) mem->va = dma_alloc_coherent(&plat_dev->dev, size, &mem->dma_addr, GFP_KERNEL); if (!mem->va) { mtk_v4l2_err(plat_dev, "%s dma_alloc size=%ld failed!", - dev_name(&plat_dev->dev), size); + __func__, size); return -ENOMEM; } @@ -99,7 +99,7 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) if (!mem->va) { mtk_v4l2_err(plat_dev, "%s dma_free size=%ld failed!", - dev_name(&plat_dev->dev), size); + __func__, size); return; } From patchwork Mon Nov 13 12:26:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 164447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1167871vqg; Mon, 13 Nov 2023 04:32:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHl/DkDEgJK/cQib4TC+ifynJsUFr0kzaBPed/3EK+7U1are+udjLWj0BbJQtyAIt62Wmf X-Received: by 2002:a17:902:8685:b0:1ca:296d:8ff6 with SMTP id g5-20020a170902868500b001ca296d8ff6mr4559291plo.38.1699878741583; Mon, 13 Nov 2023 04:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699878741; cv=none; d=google.com; s=arc-20160816; b=IMuqt+JCeblHcZXo1zhn/QR7/o85+wiMXcu/5IkJY1BYP6RLlf+KkaBEFWJvQvIQuV SIFFcp6fC9vNJP3HLqJJ45fJ2GguzpYEh7/zGFuXPd5Zg52Ag4GJRGZKBWknHjmAqmXI 5dlkh8rqBx9uF4l4Bk8rSMMEE2aISX+kMYRgnDuCYFvw1g8N5L0H50BUvTfy16Yc+QXF BwMrb/vaBU2tq5MfCC0t6QCnRQtXAk3pvjXCLxQMBYp4TBDjObue4C6x/Lx523zjcNBR zZXc9f/lUsGbDUEWH7kFT2Mwt3x59wI4QKJ9m0Var88hs+T5kzLQHXiA3c5lxzv3WFqq fieA== 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=DA3vrhjtHczEnyT2vUfzyuZkQIQYPfca5IqlMdK//sY=; fh=7on1fDOo+7RRG3zRqFvurM7lMoegCj1W5YwuRhKB6lQ=; b=t1OZLC7WrEmre2VqPlU3Q8E5Qc4i00nND/zFdWN970akcOregV1G+nX1oKByRoxbet SnqD9vi/SaovyGhn3pNfc4i//z8hZaMLa05xK976gzQ7f+EtuJh6QDBvjIurMYxnEquf I5m4/sPrWqQRiR/ulQT2UnN+kP1wupdFQH5F8SxNXrbz4eOZQFDZBQIRFBAysWIQ7TPU 0RjuztXy9OfhwWCCD0ipDYYhgHKZAaMd96ws/45t/SN9tMgcjwGjIgFknSK6AvQDNXAQ bAeMkWJ14q14gSww1xHJlJ+0/oHXuILc68JRy2KEqaU/DeivIHfTgUqQoWubYGaSVMsK u68g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JQWnwovA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e14-20020a17090301ce00b001c9fe071f2bsi5923946plh.8.2023.11.13.04.32.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JQWnwovA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C9C3980C8D6F; Mon, 13 Nov 2023 04:32:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbjKMMcS (ORCPT + 29 others); Mon, 13 Nov 2023 07:32:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230205AbjKMMcM (ORCPT ); Mon, 13 Nov 2023 07:32:12 -0500 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEAE1D53 for ; Mon, 13 Nov 2023 04:32:08 -0800 (PST) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1cc2fc281cdso31068285ad.0 for ; Mon, 13 Nov 2023 04:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699878728; x=1700483528; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DA3vrhjtHczEnyT2vUfzyuZkQIQYPfca5IqlMdK//sY=; b=JQWnwovACGdnfbYKzgRVI1WrgOV3pLfRM/U3LnJUE5JopaN00HYt9HtUcgO2klz/RV AQd2OdB93xXlGs3ylLnwYOjM0yPr8rjOsdCua5R6MZRyapO46Ly/ddC6wkntgaOY9daz 1elcWxByj5NdQFEkGBo+gT0WoeRiJA/Deq71g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699878728; x=1700483528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DA3vrhjtHczEnyT2vUfzyuZkQIQYPfca5IqlMdK//sY=; b=ZnGcgmIX0e48/Nbys0/e3ZTQ1pYuHUoKhnALIq9Av5pfb1xUiTczAQWyirp70Hln9s 1ukbjEOqEaIx2LtlRRIJKEblI1DepZQuRM5WdM42sjYr1zTRQjcwa2rAnieEJKbNy3l0 EBSzE1tL1xBOR+m9YQ0e8bRDa2n+hkfUnuifSgDHaWW4VATObumue9Q8VB4M9bkKOiee Zpr9QeUba8A4zrVKucP7Wl2v1x697jJXlZv2ss9ZoRdJX3zxC+jVcRxdYAeYx0q4SrDd CFgAL33XZx7S39+z644VoYTgVDgR+69XS2ZgMEZ/qL5wZSzJ+KfgrnjOHs/lBzk8rvVx UYaA== X-Gm-Message-State: AOJu0Yz8UIN+gGIRPOV3EQlqvMnZvNj9r6Riktwpk+H9uBAQW7UaBv2n tFcI5NvjPyHKAJ8wLAQ8vZfBfw== X-Received: by 2002:a17:903:1249:b0:1cc:5378:6a40 with SMTP id u9-20020a170903124900b001cc53786a40mr4502566plh.23.1699878728461; Mon, 13 Nov 2023 04:32:08 -0800 (PST) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:bc9:4777:173:8be3]) by smtp.gmail.com with ESMTPSA id e12-20020a170902d38c00b001bde65894c8sm3924104pld.268.2023.11.13.04.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:08 -0800 (PST) From: Fei Shao To: Hans Verkuil , AngeloGioacchino Del Regno Cc: Fei Shao , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Dufresne , =?utf-8?b?TsOtY29sYXMg?= =?utf-8?b?Ri4gUi4gQS4gUHJhZG8=?= , Tiffany Lin , Yunfei Dong , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 2/4] media: mediatek: vcodec: Drop unnecessary variable Date: Mon, 13 Nov 2023 20:26:50 +0800 Message-ID: <20231113123049.4117280-3-fshao@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231113123049.4117280-1-fshao@chromium.org> References: <20231113123049.4117280-1-fshao@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 13 Nov 2023 04:32:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782452051373545558 X-GMAIL-MSGID: 1782452051373545558 It's unclear why only mem->size has local copies without particular usage in mtk_vcodec_mem_alloc() and mtk_vcodec_mem_free(), and they seem removable. Drop them to make the code visually consistent, and update printk format identifier accordingly. Signed-off-by: Fei Shao Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/common/mtk_vcodec_util.c | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c index ea8c35c0e667..23bea2702c9a 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c @@ -49,7 +49,6 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) { enum mtk_instance_type inst_type = *((unsigned int *)priv); struct platform_device *plat_dev; - unsigned long size = mem->size; int id; if (inst_type == MTK_INST_ENCODER) { @@ -64,15 +63,15 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) id = dec_ctx->id; } - mem->va = dma_alloc_coherent(&plat_dev->dev, size, &mem->dma_addr, GFP_KERNEL); + mem->va = dma_alloc_coherent(&plat_dev->dev, mem->size, &mem->dma_addr, GFP_KERNEL); if (!mem->va) { - mtk_v4l2_err(plat_dev, "%s dma_alloc size=%ld failed!", - __func__, size); + mtk_v4l2_err(plat_dev, "%s dma_alloc size=0x%zx failed!", + __func__, mem->size); return -ENOMEM; } - mtk_v4l2_debug(plat_dev, 3, "[%d] - va = %p dma = 0x%lx size = 0x%lx", id, mem->va, - (unsigned long)mem->dma_addr, size); + mtk_v4l2_debug(plat_dev, 3, "[%d] - va = %p dma = 0x%lx size = 0x%zx", id, mem->va, + (unsigned long)mem->dma_addr, mem->size); return 0; } @@ -82,7 +81,6 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) { enum mtk_instance_type inst_type = *((unsigned int *)priv); struct platform_device *plat_dev; - unsigned long size = mem->size; int id; if (inst_type == MTK_INST_ENCODER) { @@ -98,15 +96,15 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) } if (!mem->va) { - mtk_v4l2_err(plat_dev, "%s dma_free size=%ld failed!", - __func__, size); + mtk_v4l2_err(plat_dev, "%s dma_free size=0x%zx failed!", + __func__, mem->size); return; } - mtk_v4l2_debug(plat_dev, 3, "[%d] - va = %p dma = 0x%lx size = 0x%lx", id, mem->va, - (unsigned long)mem->dma_addr, size); + mtk_v4l2_debug(plat_dev, 3, "[%d] - va = %p dma = 0x%lx size = 0x%zx", id, mem->va, + (unsigned long)mem->dma_addr, mem->size); - dma_free_coherent(&plat_dev->dev, size, mem->va, mem->dma_addr); + dma_free_coherent(&plat_dev->dev, mem->size, mem->va, mem->dma_addr); mem->va = NULL; mem->dma_addr = 0; mem->size = 0; From patchwork Mon Nov 13 12:26:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 164448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1167897vqg; Mon, 13 Nov 2023 04:32:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5UtNyD5DC4lojfuMOl/8RVG+a7WaKKGYv5YwjZfJpr+vyNsXwFodz7tpfC61/IGN4mdZG X-Received: by 2002:a05:6a00:8b8c:b0:6c4:d4b1:b535 with SMTP id ig12-20020a056a008b8c00b006c4d4b1b535mr14366206pfb.9.1699878745819; Mon, 13 Nov 2023 04:32:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699878745; cv=none; d=google.com; s=arc-20160816; b=rQyYPdgVpq4jJ/K39TP0hGvzSKCWkzUsnfFPsrdAdawrVS58Grz+kjVO2pxVdpE6jy uLaIX04BXJY1DVqh2r3f5L+5vq7gBCJNqMPvkC5QzjSaYRSk8ulCnhUqSngDn6MYsIKg UZEeh77sKO4NxDImEzo5Hv4YVrIelXXY+j647usf/SWuBr/557dTwY/j32WpNHBiPt1e vOdIm14J7NJ1XdXQROOWBdAQJxaQb2576+t8k5QUGNCc1ukKCGC3rhos9S0zOsFTlib7 RmLrEjNxyGd7WrcH/wv3txhd9y/MvHOmx3vLsuziwlrp30UkFl9bBFQEp0PYK0mWmkCl IjyA== 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=utq/LEPd9MWgyjAIqUwG3FJmsCfoE7UdWxPvzIdPYb8=; fh=7on1fDOo+7RRG3zRqFvurM7lMoegCj1W5YwuRhKB6lQ=; b=l6j66Q98LdZMsbnQTeTMua8CJaGPgg+hroUyEDfSB+sxuQQsQ17ml9YAL1NTdGu+bm vTbxL9vW6sMAhi6eMK6P+c3ejMZBw1w9TQcWY5toa7SrVcJGcDKlQbqgu8hfE33lb5ru p2vXdX1A30U0d9NLFWnHZypPicsHQj7sfL3Kws70+txJKQ3b7Vo7ysww6qz5jG5mPBqp QAKz8fGNeRJEw2s/dqPDT+jk1DEBYjya0mEA2Gpdb0wNxNnaIF3ZcHbbvCTTFaRvllps UfMHTg9vcDIu2YSnxp+6oQx0b8L+mIyb4ONKLdob8/E+ukrOLNHvoRPvKGcaoQ8faQpP qHYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JL1Y+W16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cf7-20020a056a02084700b00564c67e66fbsi6152513pgb.842.2023.11.13.04.32.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JL1Y+W16; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F391780C8D6D; Mon, 13 Nov 2023 04:32:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbjKMMcW (ORCPT + 29 others); Mon, 13 Nov 2023 07:32:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjKMMcP (ORCPT ); Mon, 13 Nov 2023 07:32:15 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15EFF1718 for ; Mon, 13 Nov 2023 04:32:12 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1cc3388621cso39173005ad.1 for ; Mon, 13 Nov 2023 04:32:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699878731; x=1700483531; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=utq/LEPd9MWgyjAIqUwG3FJmsCfoE7UdWxPvzIdPYb8=; b=JL1Y+W16jEXlhhMmbJNd7oC20YSvNbYVrK34qRtP8iTfkRIw+ELdAowPXNQfWWQalH b4/LrcQ1tRaITLVpsEP+yfNffkDQnBOHpTbaBaeTdAFnIMJryxUS7mfdH3g5Nd94bWv1 6be/DBqYGUvy2wFz7D9YwjbFgspHwZtkZH3y8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699878731; x=1700483531; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=utq/LEPd9MWgyjAIqUwG3FJmsCfoE7UdWxPvzIdPYb8=; b=PGtZO8WUUs7iLOHJ+WdOP1j2/eurkpQSGtNBtMX9zdBoo5KZG5V4FmD2Wv7VxsZXK7 T8kdX5/+au6csZPomvn+om04Q5YdV8FllILZeS6pZP/CXbOZzdREpdEenIl91whju16M tvs46nsDhM9qE3QKCQN8XXiC/DbM4C6BlxL/787Zy2fO2lA0yo6tgpXINs0dH3+5H/2c UrxoF/tYfx8hztm/VJjhNMWHhngcSEPqtkp1YQbipjXNyJ1ROGEuiJaekbxIMp0dCR2Q 57eVXPNcywNpNEo9s+oYMYhD/N+r7Yv0hl1tvWukjDRiJHM75qrx7iwcL60eBv9AUc2J U0Gw== X-Gm-Message-State: AOJu0YwGgk1UB8dSRn2YAUG5R+ZL1GciQlSkMS78zv2s1orlwdzi6h4d iFGVSs12D1U3HxH/UQHeUNzidw== X-Received: by 2002:a17:902:dac6:b0:1cc:42d0:dbc5 with SMTP id q6-20020a170902dac600b001cc42d0dbc5mr9611281plx.13.1699878731524; Mon, 13 Nov 2023 04:32:11 -0800 (PST) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:bc9:4777:173:8be3]) by smtp.gmail.com with ESMTPSA id e12-20020a170902d38c00b001bde65894c8sm3924104pld.268.2023.11.13.04.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:11 -0800 (PST) From: Fei Shao To: Hans Verkuil , AngeloGioacchino Del Regno Cc: Fei Shao , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Dufresne , =?utf-8?b?TsOtY29sYXMg?= =?utf-8?b?Ri4gUi4gQS4gUHJhZG8=?= , Tiffany Lin , Yunfei Dong , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/4] media: mediatek: vcodec: Fix mtk_vcodec_mem_free() error log criteria Date: Mon, 13 Nov 2023 20:26:51 +0800 Message-ID: <20231113123049.4117280-4-fshao@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231113123049.4117280-1-fshao@chromium.org> References: <20231113123049.4117280-1-fshao@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 13 Nov 2023 04:32:25 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782452055792865384 X-GMAIL-MSGID: 1782452055792865384 mtk_vcodec_mem_free() shouldn't print error if the target DMA buffer has never been allocated or was freed properly in the previous call. That makes log confusing. Update the error path to print log only when the caller attempts to free nonzero-size buffer with VA being NULL, which indicates something indeed went wrong. This brings another benefit that the callers no more need to check mem->va explicitly to avoid the error, which can make the code more compact and neat. Signed-off-by: Fei Shao --- .../media/platform/mediatek/vcodec/common/mtk_vcodec_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c index 23bea2702c9a..5eb267decfb6 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.c @@ -96,8 +96,9 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem) } if (!mem->va) { - mtk_v4l2_err(plat_dev, "%s dma_free size=0x%zx failed!", - __func__, mem->size); + if (mem->size) + mtk_v4l2_err(plat_dev, "%s VA is NULL but size = 0x%zx", + __func__, mem->size); return; } From patchwork Mon Nov 13 12:26:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 164450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1168386vqg; Mon, 13 Nov 2023 04:33:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFnBQAh6jMixKRtqneLNAN//mTJJv/7KjA0ZgHlm49k/okBeo6nrJ4JCevhymmaQPHlfXiW X-Received: by 2002:a17:903:4288:b0:1cc:1490:e7bf with SMTP id ju8-20020a170903428800b001cc1490e7bfmr4246751plb.30.1699878798380; Mon, 13 Nov 2023 04:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699878798; cv=none; d=google.com; s=arc-20160816; b=EMVhAquurGEvrdAbCvdwZSGgpUFxyNJnPmiLRXpTCfbJir9WEhrzzDep68vTZSPg7S l5JXAmwkz3BZS+S6XsJIdGOm89wjIZH+kxbU+OHPSomwUVnkjQwbAAgclDDsG5S9iz/5 O4iNLuLLC7J7ZlrUTKUQbtjPeCRZ1139dpd5/rwHpgLZklxdWxIzn0UbBQ82uX3pMcoE WpZLfWkv/XyFhvJ/mt5XP6Ek0lAMJCgc8Sy7H2ikz6DoquSwc3zgu7gIeYgoXFwsTvH5 5lpwS1AUaWrJqiZYDxedBAzbSV56cfhEkQdLSGy1469ceuNFLrNWMotZqydLnMeOSduX Njhw== 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=1l9/1j9sjZZ2BXUTB8Pi8Ur9IwYgx7ZdJLqIWsrQ8y4=; fh=MAwK6yz5yeKSSn58XG9Rg4OJZzJ1pkPs5L/jGm00Bqo=; b=AHIVUvn09e8jMptLm+NT5SLzM9KNHedHYYuCKwUd3/xuNpR7gNkAJRWzP3Vpww2U4J xgQQGaTfY6d4z28sFej1Fp/zdE6xObg/6byDg7RLcPK7W9klfk5UVZ//SHA/pAZBGGhp 4huCZGNCmeabk0MYr2xIzOBI2juuxtwD4obBe21DAnuEkt1NfLIVj+/JwPE1mhRYAdrt u8lorTdyy1qm1LaISX9cwfXBN8Z/Mnu0ZXT5UI5db1UVDFYgGaSmEriYIKCsM7d2Uk5t etiovL/EWUE9UedlRtm7aGnWrtD58RLrhQnwRQzxmP3xp8i7Dg64HZZ8xPPIleuaAljO niFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k0qkCsag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id t4-20020a170902e84400b001c574110eecsi5617569plg.341.2023.11.13.04.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:33:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=k0qkCsag; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 672B580A0DF0; Mon, 13 Nov 2023 04:33:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbjKMMca (ORCPT + 29 others); Mon, 13 Nov 2023 07:32:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbjKMMcU (ORCPT ); Mon, 13 Nov 2023 07:32:20 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72931736 for ; Mon, 13 Nov 2023 04:32:15 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1cc3bb4c307so31736195ad.0 for ; Mon, 13 Nov 2023 04:32:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1699878735; x=1700483535; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1l9/1j9sjZZ2BXUTB8Pi8Ur9IwYgx7ZdJLqIWsrQ8y4=; b=k0qkCsagaO0vSOzqQtVzUVi2j7EJUkQou2cS1seNLy1Fa1kWHjiHPwVRQ0HaLT+0Eo K8IMyS6OOKV6Bf3g5j9DGJTMwZ8ULN38B4NDXbL79FGbND22y61LJmHUBqCsbx+h+7aN eWnWO7XK4GbY76O4yZOOto2jxNl2yQCuxs3oA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699878735; x=1700483535; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1l9/1j9sjZZ2BXUTB8Pi8Ur9IwYgx7ZdJLqIWsrQ8y4=; b=xCNq585x3mfvvViSVy1r4YxYH8FFJHf0DCUV7pp2N4892B+svlW1wm8hA2mljRhgCM ebHMQhQ646fE/tTf8PujMJW8NaVrei3RhsSMs6L+dpqb62+OjjuNqnicTV9iTAKRShuh wb0yNHMb+ZNVpAgN1Lr3WrTjSc/B1/eyWFsMuypfLQYH+N2VPI8+/1y+h+ur/yjuWY+L y2lIc7N92q9fJSlABrI5DYcq7FXo54HdkfGgqU/DJGUNPTc47/XImhqbIzS/Nl5StNoZ bHETVwu7F5V7N3Zu30R8ltF8dNx8yzNbfUQoD+zqKzJ0bY66JBcysykPYrYKv9Pd4oAI MrDQ== X-Gm-Message-State: AOJu0Yx3yQChUYQqEwkzOdoLcakLhE3fPCzxPOgeXedaAyZ7t6768ANe 0cTo1vX+d6KN+bdk82L7zSrqaA== X-Received: by 2002:a17:902:e801:b0:1cc:25b7:e30d with SMTP id u1-20020a170902e80100b001cc25b7e30dmr4771233plg.60.1699878735055; Mon, 13 Nov 2023 04:32:15 -0800 (PST) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:bc9:4777:173:8be3]) by smtp.gmail.com with ESMTPSA id e12-20020a170902d38c00b001bde65894c8sm3924104pld.268.2023.11.13.04.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 04:32:14 -0800 (PST) From: Fei Shao To: Hans Verkuil , AngeloGioacchino Del Regno Cc: Fei Shao , Andrew-CT Chen , Dan Carpenter , Irui Wang , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Dufresne , =?utf-8?b?TsOtY29sYXMg?= =?utf-8?b?Ri4gUi4gQS4gUHJhZG8=?= , Tiffany Lin , Xiaoyong Lu , Yunfei Dong , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 4/4] media: mediatek: vcodec: Drop VA check against mtk_vcodec_mem_free() Date: Mon, 13 Nov 2023 20:26:52 +0800 Message-ID: <20231113123049.4117280-5-fshao@chromium.org> X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog In-Reply-To: <20231113123049.4117280-1-fshao@chromium.org> References: <20231113123049.4117280-1-fshao@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 13 Nov 2023 04:33:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782452111307718859 X-GMAIL-MSGID: 1782452111307718859 Now mtk_vcodec_mem_free() handles the VA-is-NULL case without generating excess error log, so we don't need to check that every time before using it in the driver. Remove all the unnecessary if branches against mtk_vcodec_mem_free(). Signed-off-by: Fei Shao --- .../vcodec/decoder/vdec/vdec_av1_req_lat_if.c | 18 ++++-------- .../vcodec/decoder/vdec/vdec_h264_if.c | 9 ++---- .../vcodec/decoder/vdec/vdec_h264_req_if.c | 9 ++---- .../decoder/vdec/vdec_h264_req_multi_if.c | 6 ++-- .../decoder/vdec/vdec_hevc_req_multi_if.c | 9 ++---- .../vcodec/decoder/vdec/vdec_vp8_if.c | 4 +-- .../vcodec/decoder/vdec/vdec_vp8_req_if.c | 12 +++----- .../vcodec/decoder/vdec/vdec_vp9_if.c | 15 ++++------ .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 29 +++++++------------ .../mediatek/vcodec/decoder/vdec_msg_queue.c | 15 ++++------ 10 files changed, 43 insertions(+), 83 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c index 2b6a5adbc419..cd3a85cd4a98 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c @@ -783,8 +783,7 @@ static int vdec_av1_slice_init_cdf_table(struct vdec_av1_slice_instance *instanc mtk_vdec_debug(ctx, "map cdf table to 0x%p\n", remote_cdf_table); - if (instance->cdf_table.va) - mtk_vcodec_mem_free(ctx, &instance->cdf_table); + mtk_vcodec_mem_free(ctx, &instance->cdf_table); instance->cdf_table.size = vsi->cdf_table_size; ret = mtk_vcodec_mem_alloc(ctx, &instance->cdf_table); @@ -814,8 +813,7 @@ static int vdec_av1_slice_init_iq_table(struct vdec_av1_slice_instance *instance mtk_vdec_debug(ctx, "map iq table to 0x%p\n", remote_iq_table); - if (instance->iq_table.va) - mtk_vcodec_mem_free(ctx, &instance->iq_table); + mtk_vcodec_mem_free(ctx, &instance->iq_table); instance->iq_table.size = vsi->iq_table_size; ret = mtk_vcodec_mem_alloc(ctx, &instance->iq_table); @@ -970,22 +968,19 @@ static int vdec_av1_slice_alloc_working_buffer(struct vdec_av1_slice_instance *i max_sb_h = DIV_ROUND_UP(max_h, 128); for (i = 0; i < AV1_MAX_FRAME_BUF_COUNT; i++) { - if (instance->mv[i].va) - mtk_vcodec_mem_free(ctx, &instance->mv[i]); + mtk_vcodec_mem_free(ctx, &instance->mv[i]); instance->mv[i].size = max_sb_w * max_sb_h * SZ_1K; ret = mtk_vcodec_mem_alloc(ctx, &instance->mv[i]); if (ret) goto err; - if (instance->seg[i].va) - mtk_vcodec_mem_free(ctx, &instance->seg[i]); + mtk_vcodec_mem_free(ctx, &instance->seg[i]); instance->seg[i].size = max_sb_w * max_sb_h * 512; ret = mtk_vcodec_mem_alloc(ctx, &instance->seg[i]); if (ret) goto err; - if (instance->cdf[i].va) - mtk_vcodec_mem_free(ctx, &instance->cdf[i]); + mtk_vcodec_mem_free(ctx, &instance->cdf[i]); instance->cdf[i].size = AV1_CDF_TABLE_BUFFER_SIZE; ret = mtk_vcodec_mem_alloc(ctx, &instance->cdf[i]); if (ret) @@ -1001,8 +996,7 @@ static int vdec_av1_slice_alloc_working_buffer(struct vdec_av1_slice_instance *i vsi->cdf_tmp.size = instance->cdf_temp.size; } - if (instance->tile.va) - mtk_vcodec_mem_free(ctx, &instance->tile); + mtk_vcodec_mem_free(ctx, &instance->tile); instance->tile.size = AV1_TILE_BUF_SIZE * V4L2_AV1_MAX_TILE_COUNT; ret = mtk_vcodec_mem_alloc(ctx, &instance->tile); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c index bf7dffe60d07..16f8fd407e09 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c @@ -157,8 +157,7 @@ static void free_predication_buf(struct vdec_h264_inst *inst) inst->vsi->pred_buf_dma = 0; mem = &inst->pred_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); } static int alloc_mv_buf(struct vdec_h264_inst *inst, struct vdec_pic_info *pic) @@ -170,8 +169,7 @@ static int alloc_mv_buf(struct vdec_h264_inst *inst, struct vdec_pic_info *pic) for (i = 0; i < H264_MAX_FB_NUM; i++) { mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem->size = buf_sz; err = mtk_vcodec_mem_alloc(inst->ctx, mem); if (err) { @@ -192,8 +190,7 @@ static void free_mv_buf(struct vdec_h264_inst *inst) for (i = 0; i < H264_MAX_FB_NUM; i++) { inst->vsi->mv_buf_dma[i] = 0; mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); } } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c index 5600f1df653d..6793fcc0fcc8 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c @@ -174,8 +174,7 @@ static void free_predication_buf(struct vdec_h264_slice_inst *inst) struct mtk_vcodec_mem *mem = &inst->pred_buf; inst->vsi_ctx.pred_buf_dma = 0; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); } static int alloc_mv_buf(struct vdec_h264_slice_inst *inst, @@ -189,8 +188,7 @@ static int alloc_mv_buf(struct vdec_h264_slice_inst *inst, mtk_v4l2_vdec_dbg(3, inst->ctx, "size = 0x%x", buf_sz); for (i = 0; i < H264_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem->size = buf_sz; err = mtk_vcodec_mem_alloc(inst->ctx, mem); if (err) { @@ -211,8 +209,7 @@ static void free_mv_buf(struct vdec_h264_slice_inst *inst) for (i = 0; i < H264_MAX_MV_NUM; i++) { inst->vsi_ctx.mv_buf_dma[i] = 0; mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); } } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c index 0e741e0dc8ba..81d21ddf5ced 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c @@ -316,8 +316,7 @@ static int vdec_h264_slice_alloc_mv_buf(struct vdec_h264_slice_inst *inst, mtk_v4l2_vdec_dbg(3, inst->ctx, "size = 0x%x", buf_sz); for (i = 0; i < H264_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem->size = buf_sz; err = mtk_vcodec_mem_alloc(inst->ctx, mem); if (err) { @@ -336,8 +335,7 @@ static void vdec_h264_slice_free_mv_buf(struct vdec_h264_slice_inst *inst) for (i = 0; i < H264_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); } } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c index 06ed47df693b..17c07feedb56 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c @@ -651,8 +651,7 @@ static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst, mtk_v4l2_vdec_dbg(3, inst->ctx, "allocate mv buffer size = 0x%x", buf_sz); for (i = 0; i < HEVC_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem->size = buf_sz; err = mtk_vcodec_mem_alloc(inst->ctx, mem); if (err) { @@ -671,8 +670,7 @@ static void vdec_hevc_slice_free_mv_buf(struct vdec_hevc_slice_inst *inst) for (i = 0; i < HEVC_MAX_MV_NUM; i++) { mem = &inst->mv_buf[i]; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); } } @@ -913,8 +911,7 @@ static void vdec_hevc_slice_deinit(void *h_vdec) vdec_hevc_slice_free_mv_buf(inst); mem = &inst->wrap_addr; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); vdec_msg_queue_deinit(&inst->ctx->msg_queue, inst->ctx); kfree(inst); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c index 19407f9bc773..7bcc3566371c 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c @@ -379,9 +379,7 @@ static void free_working_buf(struct vdec_vp8_inst *inst) { struct mtk_vcodec_mem *mem = &inst->working_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); - + mtk_vcodec_mem_free(inst->ctx, mem); inst->vsi->dec.working_buf_dma = 0; } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c index f64b21c07169..9a2710104a16 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c @@ -192,23 +192,19 @@ static void vdec_vp8_slice_free_working_buf(struct vdec_vp8_slice_inst *inst) struct mtk_vcodec_mem *mem; mem = &inst->seg_id_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); inst->vsi->dec.seg_id_buf_dma = 0; mem = &inst->wrap_y_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); inst->vsi->dec.wrap_y_dma = 0; mem = &inst->wrap_c_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); inst->vsi->dec.wrap_c_dma = 0; mem = &inst->vld_wrapper_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); inst->vsi->dec.vld_wrapper_dma = 0; } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c index 55355fa70090..5def2d228fa3 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c @@ -387,8 +387,7 @@ static bool vp9_alloc_work_buf(struct vdec_vp9_inst *inst) vsi->pic_h, vsi->buf_w, vsi->buf_h); mem = &inst->mv_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem->size = ((vsi->buf_w / 64) * (vsi->buf_h / 64) + 2) * 36 * 16; @@ -405,8 +404,7 @@ static bool vp9_alloc_work_buf(struct vdec_vp9_inst *inst) mem = &inst->seg_id_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem->size = VP9_SEG_ID_SZ; result = mtk_vcodec_mem_alloc(inst->ctx, mem); @@ -567,8 +565,7 @@ static void vp9_free_inst(struct vdec_vp9_inst *inst) struct mtk_vcodec_mem mem; mem = inst->mem; - if (mem.va) - mtk_vcodec_mem_free(inst->ctx, &mem); + mtk_vcodec_mem_free(inst->ctx, &mem); } static bool vp9_decode_end_proc(struct vdec_vp9_inst *inst) @@ -761,12 +758,10 @@ static void vdec_vp9_deinit(void *h_vdec) mtk_vdec_err(inst->ctx, "vpu_dec_deinit failed"); mem = &inst->mv_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); mem = &inst->seg_id_buf; - if (mem->va) - mtk_vcodec_mem_free(inst->ctx, mem); + mtk_vcodec_mem_free(inst->ctx, mem); vp9_free_all_sf_ref_fb(inst); vp9_free_inst(inst); diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c index e393e3e668f8..b885730826fb 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c @@ -590,8 +590,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i size = (max_sb_w * max_sb_h + 2) * 576; for (i = 0; i < 2; i++) { - if (instance->mv[i].va) - mtk_vcodec_mem_free(ctx, &instance->mv[i]); + mtk_vcodec_mem_free(ctx, &instance->mv[i]); instance->mv[i].size = size; if (mtk_vcodec_mem_alloc(ctx, &instance->mv[i])) goto err; @@ -599,8 +598,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *i size = (max_sb_w * max_sb_h * 32) + 256; for (i = 0; i < 2; i++) { - if (instance->seg[i].va) - mtk_vcodec_mem_free(ctx, &instance->seg[i]); + mtk_vcodec_mem_free(ctx, &instance->seg[i]); instance->seg[i].size = size; if (mtk_vcodec_mem_alloc(ctx, &instance->seg[i])) goto err; @@ -637,20 +635,15 @@ static void vdec_vp9_slice_free_working_buffer(struct vdec_vp9_slice_instance *i struct mtk_vcodec_dec_ctx *ctx = instance->ctx; int i; - for (i = 0; i < ARRAY_SIZE(instance->mv); i++) { - if (instance->mv[i].va) - mtk_vcodec_mem_free(ctx, &instance->mv[i]); - } - for (i = 0; i < ARRAY_SIZE(instance->seg); i++) { - if (instance->seg[i].va) - mtk_vcodec_mem_free(ctx, &instance->seg[i]); - } - if (instance->tile.va) - mtk_vcodec_mem_free(ctx, &instance->tile); - if (instance->prob.va) - mtk_vcodec_mem_free(ctx, &instance->prob); - if (instance->counts.va) - mtk_vcodec_mem_free(ctx, &instance->counts); + for (i = 0; i < ARRAY_SIZE(instance->mv); i++) + mtk_vcodec_mem_free(ctx, &instance->mv[i]); + + for (i = 0; i < ARRAY_SIZE(instance->seg); i++) + mtk_vcodec_mem_free(ctx, &instance->seg[i]); + + mtk_vcodec_mem_free(ctx, &instance->tile); + mtk_vcodec_mem_free(ctx, &instance->prob); + mtk_vcodec_mem_free(ctx, &instance->counts); instance->level = VP9_RES_NONE; } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c index f283c4703dc6..7b426bb8b1de 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.c @@ -206,26 +206,21 @@ void vdec_msg_queue_deinit(struct vdec_msg_queue *msg_queue, int i; mem = &msg_queue->wdma_addr; - if (mem->va) - mtk_vcodec_mem_free(ctx, mem); + mtk_vcodec_mem_free(ctx, mem); for (i = 0; i < NUM_BUFFER_COUNT; i++) { lat_buf = &msg_queue->lat_buf[i]; mem = &lat_buf->wdma_err_addr; - if (mem->va) - mtk_vcodec_mem_free(ctx, mem); + mtk_vcodec_mem_free(ctx, mem); mem = &lat_buf->slice_bc_addr; - if (mem->va) - mtk_vcodec_mem_free(ctx, mem); + mtk_vcodec_mem_free(ctx, mem); mem = &lat_buf->rd_mv_addr; - if (mem->va) - mtk_vcodec_mem_free(ctx, mem); + mtk_vcodec_mem_free(ctx, mem); mem = &lat_buf->tile_addr; - if (mem->va) - mtk_vcodec_mem_free(ctx, mem); + mtk_vcodec_mem_free(ctx, mem); kfree(lat_buf->private_data); lat_buf->private_data = NULL;