Skip to contentSkip to conversation

fbdev: vt8500lcdfb: fix missing dma_free_coherent()

PATCH In review Thomas Fourier 3 participants 3 messages Jan 12 – Jan 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fbdev: vt8500lcdfb: fix missing dma_free_coherent()

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")
---
 drivers/video/fbdev/vt8500lcdfb.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/video/fbdev/vt8500lcdfb.c +4 -1
index b08a6fdc53fd..85c7a99a7d64 100644
@@ -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:
Signature · 1 line
2.43.0
#1 lore raw
Quoted 1 line

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

Quoted 1 line

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

maintainer
#2 lore raw
In reply to Thomas Fourier
Quoted 1 line · Thomas Fourier

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

Quoted 8 lines

freed if the error path is reached.

Fixes e7b995371fe1 ("video: vt8500: Add devicetree support for vt8500-fb and wm8505-fb")
---
  drivers/video/fbdev/vt8500lcdfb.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)