The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm: tegra: fix memory leak in error handling path
@ 2022-03-29 10:37 cgel.zte
  2022-03-29 10:55 ` Jon Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-03-29 10:37 UTC (permalink / raw)
  To: thierry.reding
  Cc: airlied, daniel, jonathanh, dri-devel, linux-tegra, linux-kernel,
	Lv Ruyi, Zeal Robot

From: Lv Ruyi <lv.ruyi@zte.com.cn>

Before leave the nvdec_load_firmware, we shuold free virt which is alloced
by dma_alloc_coherent, so change "return err" to "goto cleanup".

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
 drivers/gpu/drm/tegra/nvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/nvdec.c b/drivers/gpu/drm/tegra/nvdec.c
index 79e1e88203cf..a14863346bfa 100644
--- a/drivers/gpu/drm/tegra/nvdec.c
+++ b/drivers/gpu/drm/tegra/nvdec.c
@@ -209,7 +209,7 @@ static int nvdec_load_firmware(struct nvdec *nvdec)
 
 		err = dma_mapping_error(nvdec->dev, iova);
 		if (err < 0)
-			return err;
+			goto cleanup;
 	} else {
 		virt = tegra_drm_alloc(tegra, size, &iova);
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-29 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-29 10:37 [PATCH] drm: tegra: fix memory leak in error handling path cgel.zte
2022-03-29 10:55 ` Jon Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox