mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
media: mediatek: vcodec: Drop unnecessary variable
In mtk_vcodec_mem_alloc() and mtk_vcodec_mem_free(), the value of mem->size is not expected to change before and when using the DMA APIs and debug print, so there's no point in keeping local copies of it. Drop the local variable "size" in the mentioned functions, and update printk format identifiers accordingly. This makes the code slightly more visually consistent, and retrieve a small amount of memory that is used for no real purpose. Signed-off-by: Fei Shao <fshao@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
c742a19500
commit
3de2a2184d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user