Skip to contentSkip to conversation

sh: free-without-alloc fix for sh_mobile_lcdcfb

PATCH Applied Magnus Damm 2 participants 2 messages Oct 13, 2010

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

PATCH 1/1 sh: free-without-alloc fix for sh_mobile_lcdcfb

From: Magnus Damm <[email protected]>

Without this fix the LCDC driver will try to free framebuffer memory even though the allocation failed.

---

 drivers/video/sh_mobile_lcdcfb.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/video/sh_mobile_lcdcfb.c +4 -2
@@ -1324,8 +1324,10 @@ static int sh_mobile_lcdc_remove(struct 
 		if (priv->ch[i].sglist)
 			vfree(priv->ch[i].sglist);
 
-		dma_free_coherent(&pdev->dev, info->fix.smem_len,
-				  info->screen_base, priv->ch[i].dma_handle);
+		if (info->screen_base)
+			dma_free_coherent(&pdev->dev, info->fix.smem_len,
+					  info->screen_base,
+					  priv->ch[i].dma_handle);
 		fb_dealloc_cmap(&info->cmap);
 		framebuffer_release(info);
 	}
Applied
#1 lore raw
Quoted 2 lines · Magnus Damm

Without this fix the LCDC driver will try to free framebuffer memory even though the allocation failed.

Applied, thanks.