From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Fei Shao <fshao@chromium.org>, Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: "Andrew-CT Chen" <andrew-ct.chen@mediatek.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Nicolas Dufresne" <nicolas.dufresne@collabora.com>,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Tiffany Lin" <tiffany.lin@mediatek.com>,
"Yunfei Dong" <yunfei.dong@mediatek.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 3/4] media: mediatek: vcodec: Fix mtk_vcodec_mem_free() error log criteria
Date: Wed, 6 Dec 2023 11:19:32 +0100 [thread overview]
Message-ID: <6c693161-0e89-4f9d-9a92-18f3783eefd2@collabora.com> (raw)
In-Reply-To: <20231113123049.4117280-4-fshao@chromium.org>
Il 13/11/23 13:26, Fei Shao ha scritto:
> 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 <fshao@chromium.org>
I think that this error is supposed to catch two issues in one:
- We're called to free no memory (something that does make no sense),
this may happen for example when calling xxx_free() twice, and it
is a mistake that *must* be fixed;
- We're failing to free memory for real (which you covered)
....that said, I think that if you want to clarify the error messages
in this function, it should look something like this:
if (!mem->va) {
mtk_v4l2_err(plat_dev, "%s: Tried to free a NULL VA", __func__);
if (mem->size)
mtk_v4l2_err(plat_dev, "Failed to free %lu bytes", mem->size);
return;
}
Cheers,
Angelo
next prev parent reply other threads:[~2023-12-06 10:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 12:26 [PATCH 0/4] Improvement around mtk_vcodec_mem_free() logging and usage Fei Shao
2023-11-13 12:26 ` [PATCH 1/4] media: mediatek: vcodec: Replace dev_name in error string Fei Shao
2023-12-06 10:19 ` AngeloGioacchino Del Regno
2023-11-13 12:26 ` [PATCH 2/4] media: mediatek: vcodec: Drop unnecessary variable Fei Shao
2023-12-06 10:19 ` AngeloGioacchino Del Regno
2023-12-07 11:14 ` Fei Shao
2023-11-13 12:26 ` [PATCH 3/4] media: mediatek: vcodec: Fix mtk_vcodec_mem_free() error log criteria Fei Shao
2023-12-06 10:19 ` AngeloGioacchino Del Regno [this message]
2023-12-07 11:17 ` Fei Shao
2023-12-07 12:54 ` AngeloGioacchino Del Regno
2023-12-08 4:22 ` Fei Shao
2023-11-13 12:26 ` [PATCH 4/4] media: mediatek: vcodec: Drop VA check against mtk_vcodec_mem_free() Fei Shao
2023-12-06 10:19 ` AngeloGioacchino Del Regno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c693161-0e89-4f9d-9a92-18f3783eefd2@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=andrew-ct.chen@mediatek.com \
--cc=fshao@chromium.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=nfraprado@collabora.com \
--cc=nicolas.dufresne@collabora.com \
--cc=tiffany.lin@mediatek.com \
--cc=yunfei.dong@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®