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: 13453941 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 7C0C8C4332F for ; Mon, 13 Nov 2023 12:32:43 +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: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=jmt9Vr9OLlheZGjxJmKgbXTLvZwgqiyb41BLWQ87Zig=; b=JHcUloJzSroycS 2luD+2gfQAFeyeau8D3H0T/je/jTfb/y5wLeoQmCrNSk2UTbmZP7gnRv1BPUqIr3z4nL79fdW1rzl 0nwd1kcWMSCb4s+J9R20YA7NvlwOmpcoI194gVUfo2nc2HmKFCmLvzw/T7EzT0RIgpn9J5X69p40X 40ZLzkovVZHR1errRB5s3Qes2Tu82XWnYd/ElEndBcdQ1pjhIYNHYeEC9RitVxZ7EkN/GDZkBToWe jw1alk8c6n6tl7OpWA9X1lgT4oNoFJ7PvzvCYwot+xBm2G7tNrv56OoEFL5b4ERCsGDHUit5jmjB5 wqdZUnIcMqsY4XA3Jdcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r2W70-00Dxsn-38; Mon, 13 Nov 2023 12:32:18 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r2W6v-00DxmY-20 for linux-arm-kernel@lists.infradead.org; Mon, 13 Nov 2023 12:32:14 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1cc131e52f1so39313805ad.0 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=lists.infradead.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=fWp6edFZ8/X4O3hB7uD15ufqngN3k0VulZQYHXT4EsAEB6q2Mbgg4gr+t2GXlhKFFS 0bn9GBgjYKIEENERLaFXTcUrLvFUhUSoXz5xN/UmfYUeXRBLf5s0S1CLRQV3b8EXVvYZ gkHs6vaL3/mGqmAXqfWT+jxnrxJK+UKZ3sEjU= 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=pEMhhBa5LVAQiTWjtTK1umHRpjnaC4Mk9i1ujnRQFYCQLSMsuuze13rxmebzJNNtzi fqfRs2qQZO/NvRhuN5BzzM/Ri/3AylOg0n5N6ovRdk1Z0+JblDbkJXNVW8G63MT07A9p 6vGdutqblD89/QEQ1ie48wviNg6Tk9N3QNE2qB8UIaQkbPeX9SlhKNVXaevJv4tFFFji fbnLYxMP4Hc+r0YYHAdAhJwYfT7kpqxrRbPvAyGc77GWlGWEa+BmdfFWJy5FYgKC1eNn YCCNHfHNgt3MHgs05la1nNogcAoGDhX5ybzVHksBrhIb3rCfj9yj+ANMptSuacDim5Ww gC5A== X-Gm-Message-State: AOJu0Yzf+lAxNKYxY0dzGzlgiyKf+qpRSkWVvItwJOJbt17inVoqI4Ja KEF/4ZVaNxO5aoqyRYlto+29+g== X-Google-Smtp-Source: AGHT+IGG/zF/QwLP8a9jX0YqCzyCMTgh29CNbFu1TQxkbJZaAa/VU3oDqMMh5ijHm1SKJCkxOnMJZQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231113_043213_668744_5E70608A X-CRM114-Status: GOOD ( 14.76 ) 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 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; }