[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c693161-0e89-4f9d-9a92-18f3783eefd2@collabora.com>
Date: Wed, 6 Dec 2023 11:19:32 +0100
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Fei Shao <fshao@...omium.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>
Cc: Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Nicolas Dufresne <nicolas.dufresne@...labora.com>,
NĂcolas F. R. A. Prado
<nfraprado@...labora.com>, Tiffany Lin <tiffany.lin@...iatek.com>,
Yunfei Dong <yunfei.dong@...iatek.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 3/4] media: mediatek: vcodec: Fix mtk_vcodec_mem_free()
error log criteria
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@...omium.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
Powered by blists - more mailing lists