From patchwork Thu Dec 21 09:17:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 182102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp289890dyi; Thu, 21 Dec 2023 01:29:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3CpYl+pFFPF9Xs3Ju89xm1Mn06AjQzVoIHLOM1hg/TIJHXv+BTtfx1Tg9Tm9DYJZ0EnVW X-Received: by 2002:ac8:58d3:0:b0:427:87d3:6136 with SMTP id u19-20020ac858d3000000b0042787d36136mr2918681qta.1.1703150987943; Thu, 21 Dec 2023 01:29:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703150987; cv=none; d=google.com; s=arc-20160816; b=qOMJ59QQ3Y24W2V59mcFqeg7V/vAiua7UlD0HkMBZY/GjySIA+avUziJHl/blfZT0k uMjYi5uKeMcVraz/jlmqnmouxx8FEeCQqN7uwLBqDnOSYZ2+IyqhGanWZqYjPsuow2c1 /Y8xabOls51bb/Onf8zlFGffYP+TYTcn8/Xl7RxQaPi6uA07pTwGbFLysmlCWSqdnm3k /Amg/zMzQC3mWGugIbU4+q8cFzDCnDWjjsTDKOdhrLA7yVgzimH3u5J8gedn32IiLgsh d4cG0VRMaeinwSNmvjanojrN+ob4fZexafy81BVfCBGHUS30eJ8jSKgCcHsNZFEoFCo5 OjAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YpgYqGOhJKgjrH+Y+gow5aHhwckMqDVFEItsLP1DgtE=; fh=DCT4jDjkLHZUGvEUTEyHFjdV2W2QSe4+4u0RPV+2WD0=; b=grwPCC9CtHTNCghENdAtMD3h5FqKYxHzIcunqiuHVBjyL+WKsWzXvEkCDQVry+gnh7 96afilpSCGoHUeGss3L5+NMoMaRXbbHVhn32Z3NVGLnQBcJV9c5r5nXNgdP7QxKWEEmE GnzqryS4KdZySppIgQq1UzQfOF+n7QvTV8ID3YXNOUWPLTW1cYgbmvnCY5q9nejs96Q9 PzOYHEmJGKNzCjWj2Qm0Iqsnku4BARQAGUrgfyBmHb3LJlRmuH03rPyjWpx6YzC6PJrq KzHWyBceGrY0GEW+a4tzuYQifEBe6vHIS/9zn5TY/3Vz9wBhv4PLgWH9lF3lT1tymKzo wSTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AtNvv4dn; spf=pass (google.com: domain of linux-kernel+bounces-8113-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8113-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c9-20020a05622a058900b00423a8bd0b44si1646716qtb.797.2023.12.21.01.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 01:29:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8113-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AtNvv4dn; spf=pass (google.com: domain of linux-kernel+bounces-8113-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8113-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D5161C237C9 for ; Thu, 21 Dec 2023 09:29:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0D004E60F; Thu, 21 Dec 2023 09:23:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="AtNvv4dn" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B187B3C693 for ; Thu, 21 Dec 2023 09:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6d532e4f6d6so309129b3a.2 for ; Thu, 21 Dec 2023 01:23:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1703150606; x=1703755406; 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=YpgYqGOhJKgjrH+Y+gow5aHhwckMqDVFEItsLP1DgtE=; b=AtNvv4dnqqqoQIcnxmMRYfV3RJ3eJvizPDs1/uAi0JFwzaDNsM8EFQzMYINH9G3dG6 hpjm4sz4XML+0gm0W6nchdSW2vBCGJNHF43yiP4U8Ku/pXWin7A24q2vSu1ArtgQEzL+ SUci/2oiqF6PqFKK4K3SMkaX5wDCX9+TcfeYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703150606; x=1703755406; 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=YpgYqGOhJKgjrH+Y+gow5aHhwckMqDVFEItsLP1DgtE=; b=IyM9G/IMTn69iEicDCk9aZl1zqkTAZ8iLv9TRkG8YPZQfYMgbIujSh4HDoTrQO6/kF /9PHb0WFExThoBZIqJ0wss52pWn19Ru97rvJpoia1W7bnEJFU2imVrrCHEaJS9OgUIRo OfU1bYZCAvrkz8WajQgM2T/S+sLdB11MnqdMMERUddRFXe4+z8+2zUziLzpdgN5fzpUy +ZnQEvmPbhw/qnaGKn6GG7P+GWoBABXnzhQCa0wBkDsTZnPKfFtaTGBTVRbi8VFyPP12 dR/FLHLh2EIOOJbWisc1tJ9jYXVqk46djRdGibR58weCHz7iHyM3WYkSNYvl2Fkc/R8l iJnw== X-Gm-Message-State: AOJu0YzXBbUz3pXeItpQSS/Ejsb9rEpuLZsO8vAUOkPpK42FbBa1sQ/a d5zp+OYl/MIbIro7FKc96NohRg== X-Received: by 2002:a05:6a20:2e25:b0:188:1df7:9afe with SMTP id be37-20020a056a202e2500b001881df79afemr560527pzb.30.1703150606111; Thu, 21 Dec 2023 01:23:26 -0800 (PST) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:5d8a:fab1:933a:9ae9]) by smtp.gmail.com with ESMTPSA id l6-20020a17090add8600b00274b035246esm1001915pjv.1.2023.12.21.01.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 01:23:25 -0800 (PST) From: Fei Shao To: Hans Verkuil , AngeloGioacchino Del Regno Cc: Fei Shao , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Nicolas Dufresne , 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 v2 3/4] media: mediatek: vcodec: Update mtk_vcodec_mem_free() error messages Date: Thu, 21 Dec 2023 17:17:45 +0800 Message-ID: <20231221092226.1395427-3-fshao@chromium.org> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231221092226.1395427-1-fshao@chromium.org> References: <20231221092226.1395427-1-fshao@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785883250655677035 X-GMAIL-MSGID: 1785883250655677035 In mtk_vcodec_mem_free(), there are two cases where a NULL VA is passed: - mem->size == 0: we are called to free no memory. This may happen when we call mtk_vcodec_mem_free() twice or the memory has never been allocated. - mem->size > 0: we are called to free memory but without VA. This means that we failed to free the memory for real. Both cases are not expected to happen, and we want to have clearer error messages to describe which one we just encountered. Update the error messages to include more information for that purpose. Signed-off-by: Fei Shao Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2: - update the error messages based on the suggestion .../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..c60e4c193b25 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); + mtk_v4l2_err(plat_dev, "%s: Tried to free a NULL VA", __func__); + if (mem->size) + mtk_v4l2_err(plat_dev, "Failed to free %zu bytes", mem->size); return; }