]> Git Repo - J-linux.git/commitdiff
fbdev: sh7760fb: Fix a possible memory leak in sh7760fb_alloc_mem()
authorZhen Lei <[email protected]>
Sat, 26 Oct 2024 03:56:34 +0000 (11:56 +0800)
committerHelge Deller <[email protected]>
Thu, 14 Nov 2024 14:26:27 +0000 (15:26 +0100)
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: 4a25e41831ee ("video: sh7760fb: SH7760/SH7763 LCDC framebuffer driver")
Signed-off-by: Zhen Lei <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
Signed-off-by: Helge Deller <[email protected]>
drivers/video/fbdev/sh7760fb.c

index 3d2a27fefc874a766b27c0ab9984bb2676d5abb5..130adef2e4686974950a3566ea4ecb0f08f0826a 100644 (file)
@@ -409,12 +409,11 @@ static int sh7760fb_alloc_mem(struct fb_info *info)
                vram = PAGE_SIZE;
 
        fbmem = dma_alloc_coherent(info->device, vram, &par->fbdma, GFP_KERNEL);
-
        if (!fbmem)
                return -ENOMEM;
 
        if ((par->fbdma & SH7760FB_DMA_MASK) != SH7760FB_DMA_MASK) {
-               sh7760fb_free_mem(info);
+               dma_free_coherent(info->device, vram, fbmem, par->fbdma);
                dev_err(info->device, "kernel gave me memory at 0x%08lx, which is"
                        "unusable for the LCDC\n", (unsigned long)par->fbdma);
                return -ENOMEM;
This page took 0.051511 seconds and 4 git commands to generate.