sh: free-without-alloc fix for sh_mobile_lcdcfb
authorMagnus Damm <damm@opensource.se>
Wed, 13 Oct 2010 07:17:45 +0000 (07:17 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 13 Oct 2010 10:16:44 +0000 (19:16 +0900)
Without this fix the LCDC driver will try to free
framebuffer memory even though the allocation failed.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/video/sh_mobile_lcdcfb.c

index d72075a9f01c367ceb9e573f3a475774db6a4b80..7a1419279c8f501bf4d94a4101259cf6aaa0860e 100644 (file)
@@ -1243,8 +1243,10 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev)
                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);
        }