diff options
author | Zhen Lei <thunder.leizhen@huawei.com> | 2024-10-26 11:56:34 +0800 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2024-11-14 15:26:27 +0100 |
commit | f89d17ae2ac42931be2a0153fecbf8533280c927 (patch) | |
tree | e3fc1273e27cb2d83305fb501f5e207c6647873a /drivers/video/fbdev/sh7760fb.c | |
parent | 2d5404caa8c7bb5c4e0435f94b28834ae5456623 (diff) | |
download | lwn-f89d17ae2ac42931be2a0153fecbf8533280c927.tar.gz lwn-f89d17ae2ac42931be2a0153fecbf8533280c927.zip |
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: 4a25e41831ee ("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>
Diffstat (limited to 'drivers/video/fbdev/sh7760fb.c')
-rw-r--r-- | drivers/video/fbdev/sh7760fb.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/video/fbdev/sh7760fb.c b/drivers/video/fbdev/sh7760fb.c index 3d2a27fefc87..130adef2e468 100644 --- a/drivers/video/fbdev/sh7760fb.c +++ b/drivers/video/fbdev/sh7760fb.c @@ -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; |