[PATCH] fbdev: vt8500lcdfb: fix missing dma_free_coherent()

Thomas Fourier posted 1 patch 3 weeks, 5 days ago
drivers/video/fbdev/vt8500lcdfb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
[PATCH] fbdev: vt8500lcdfb: fix missing dma_free_coherent()
Posted by Thomas Fourier 3 weeks, 5 days ago
fbi->fb.screen_buffer is alloced with dma_free_coherent() but is not
freed if the error path is reached.

Fixes: e7b995371fe1 ("video: vt8500: Add devicetree support for vt8500-fb and wm8505-fb")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/video/fbdev/vt8500lcdfb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c
index b08a6fdc53fd..85c7a99a7d64 100644
--- a/drivers/video/fbdev/vt8500lcdfb.c
+++ b/drivers/video/fbdev/vt8500lcdfb.c
@@ -369,7 +369,7 @@ static int vt8500lcd_probe(struct platform_device *pdev)
 	if (fbi->palette_cpu == NULL) {
 		dev_err(&pdev->dev, "Failed to allocate palette buffer\n");
 		ret = -ENOMEM;
-		goto failed_free_io;
+		goto failed_free_mem_virt;
 	}
 
 	irq = platform_get_irq(pdev, 0);
@@ -432,6 +432,9 @@ static int vt8500lcd_probe(struct platform_device *pdev)
 failed_free_palette:
 	dma_free_coherent(&pdev->dev, fbi->palette_size,
 			  fbi->palette_cpu, fbi->palette_phys);
+failed_free_mem_virt:
+	dma_free_coherent(&pdev->dev, fbi->fb.fix.smem_len,
+			  fbi->fb.screen_buffer, fbi->fb.fix.smem_start);
 failed_free_io:
 	iounmap(fbi->regbase);
 failed_free_res:
-- 
2.43.0
Re: [PATCH] fbdev: vt8500lcdfb: fix missing dma_free_coherent()
Posted by Helge Deller 1 week, 3 days ago
On 1/12/26 15:00, Thomas Fourier wrote:
> fbi->fb.screen_buffer is alloced with dma_free_coherent() but is not

I've corrected this to "dma_alloc_coherent()", as pointed out by Mr. Elfring,
and applied it to the fbdev tree.

Thanks!
Helge

> freed if the error path is reached.
> 
> Fixes: e7b995371fe1 ("video: vt8500: Add devicetree support for vt8500-fb and wm8505-fb")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---
>   drivers/video/fbdev/vt8500lcdfb.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
Re: [PATCH] fbdev: vt8500lcdfb: fix missing dma_free_coherent()
Posted by Markus Elfring 3 weeks, 5 days ago
> fbi->fb.screen_buffer is alloced with dma_free_coherent() but is not

                           allocated with a dma_alloc_coherent() call?

https://elixir.bootlin.com/linux/v6.19-rc4/source/drivers/video/fbdev/vt8500lcdfb.c#L352-L362


> freed if the error path is reached.

See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc4#n94


You should probably not only specify message recipients in the header field “Cc”.

Regards,
Markus