Commit 35887b1c authored by Andres Salomon's avatar Andres Salomon Committed by Linus Torvalds

gx1fb: properly alloc cmap and plug cmap leak

We weren't properly allocating the cmap for depths greater than 8bpp,
which caused pain for things like DirectFB.  Also, we never freed the cmap
memory upon module unload..
Signed-off-by: default avatarAndres Salomon <dilinger@debian.org>
Cc: Marco La Porta <marco-laporta@tiscali.it>
Cc: Jordan Crouse <jordan@cosmicpenguin.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b14caecd
...@@ -136,13 +136,10 @@ static int gx1fb_set_par(struct fb_info *info) ...@@ -136,13 +136,10 @@ static int gx1fb_set_par(struct fb_info *info)
{ {
struct geodefb_par *par = info->par; struct geodefb_par *par = info->par;
if (info->var.bits_per_pixel == 16) { if (info->var.bits_per_pixel == 16)
info->fix.visual = FB_VISUAL_TRUECOLOR; info->fix.visual = FB_VISUAL_TRUECOLOR;
fb_dealloc_cmap(&info->cmap); else
} else {
info->fix.visual = FB_VISUAL_PSEUDOCOLOR; info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
}
info->fix.line_length = gx1_line_delta(info->var.xres, info->var.bits_per_pixel); info->fix.line_length = gx1_line_delta(info->var.xres, info->var.bits_per_pixel);
...@@ -315,6 +312,10 @@ static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev) ...@@ -315,6 +312,10 @@ static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev)
if (!par->panel_x) if (!par->panel_x)
par->enable_crt = 1; /* fall back to CRT if no panel is specified */ par->enable_crt = 1; /* fall back to CRT if no panel is specified */
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
framebuffer_release(info);
return NULL;
}
return info; return info;
} }
...@@ -374,8 +375,11 @@ static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id * ...@@ -374,8 +375,11 @@ static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *
release_mem_region(gx1_gx_base() + 0x8300, 0x100); release_mem_region(gx1_gx_base() + 0x8300, 0x100);
} }
if (info) if (info) {
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info); framebuffer_release(info);
}
return ret; return ret;
} }
...@@ -395,6 +399,7 @@ static void gx1fb_remove(struct pci_dev *pdev) ...@@ -395,6 +399,7 @@ static void gx1fb_remove(struct pci_dev *pdev)
iounmap(par->dc_regs); iounmap(par->dc_regs);
release_mem_region(gx1_gx_base() + 0x8300, 0x100); release_mem_region(gx1_gx_base() + 0x8300, 0x100);
fb_dealloc_cmap(&info->cmap);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
framebuffer_release(info); framebuffer_release(info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment