Skip to content

Commit f89d17a

Browse files
Zhen Leihdeller
authored andcommitted
fbdev: sh7760fb: Fix a possible memory leak in sh7760fb_alloc_mem()
When information such as info->screen_base is not ready, calling sh7760fb_free_mem() does not release memory correctly. Call dma_free_coherent() instead. Fixes: 4a25e41 ("video: sh7760fb: SH7760/SH7763 LCDC framebuffer driver") Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 2d5404c commit f89d17a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/video/fbdev/sh7760fb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,11 @@ static int sh7760fb_alloc_mem(struct fb_info *info)
409409
vram = PAGE_SIZE;
410410

411411
fbmem = dma_alloc_coherent(info->device, vram, &par->fbdma, GFP_KERNEL);
412-
413412
if (!fbmem)
414413
return -ENOMEM;
415414

416415
if ((par->fbdma & SH7760FB_DMA_MASK) != SH7760FB_DMA_MASK) {
417-
sh7760fb_free_mem(info);
416+
dma_free_coherent(info->device, vram, fbmem, par->fbdma);
418417
dev_err(info->device, "kernel gave me memory at 0x%08lx, which is"
419418
"unusable for the LCDC\n", (unsigned long)par->fbdma);
420419
return -ENOMEM;

0 commit comments

Comments
 (0)