diff options
author | Andres Salomon <dilinger@queued.net> | 2009-02-11 16:04:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-11 17:25:34 -0500 |
commit | 35887b1cf74dc751dd0574b26515142d3cea9376 (patch) | |
tree | fd93c7df28ebcd6a398cdb80d8e66c468d0765fe /drivers/video/geode | |
parent | b14caecdbe7730bf82c8510f1ba52e00273e15c4 (diff) |
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: Andres Salomon <dilinger@debian.org>
Cc: Marco La Porta <marco-laporta@tiscali.it>
Cc: Jordan Crouse <jordan@cosmicpenguin.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/geode')
-rw-r--r-- | drivers/video/geode/gx1fb_core.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/video/geode/gx1fb_core.c b/drivers/video/geode/gx1fb_core.c index 751e491ca8c8..f20eff8c4a81 100644 --- a/drivers/video/geode/gx1fb_core.c +++ b/drivers/video/geode/gx1fb_core.c | |||
@@ -136,13 +136,10 @@ static int gx1fb_set_par(struct fb_info *info) | |||
136 | { | 136 | { |
137 | struct geodefb_par *par = info->par; | 137 | struct geodefb_par *par = info->par; |
138 | 138 | ||
139 | if (info->var.bits_per_pixel == 16) { | 139 | if (info->var.bits_per_pixel == 16) |
140 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 140 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
141 | fb_dealloc_cmap(&info->cmap); | 141 | else |
142 | } else { | ||
143 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; | 142 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; |
144 | fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0); | ||
145 | } | ||
146 | 143 | ||
147 | info->fix.line_length = gx1_line_delta(info->var.xres, info->var.bits_per_pixel); | 144 | info->fix.line_length = gx1_line_delta(info->var.xres, info->var.bits_per_pixel); |
148 | 145 | ||
@@ -315,6 +312,10 @@ static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev) | |||
315 | if (!par->panel_x) | 312 | if (!par->panel_x) |
316 | par->enable_crt = 1; /* fall back to CRT if no panel is specified */ | 313 | par->enable_crt = 1; /* fall back to CRT if no panel is specified */ |
317 | 314 | ||
315 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | ||
316 | framebuffer_release(info); | ||
317 | return NULL; | ||
318 | } | ||
318 | return info; | 319 | return info; |
319 | } | 320 | } |
320 | 321 | ||
@@ -374,8 +375,11 @@ static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id * | |||
374 | release_mem_region(gx1_gx_base() + 0x8300, 0x100); | 375 | release_mem_region(gx1_gx_base() + 0x8300, 0x100); |
375 | } | 376 | } |
376 | 377 | ||
377 | if (info) | 378 | if (info) { |
379 | fb_dealloc_cmap(&info->cmap); | ||
378 | framebuffer_release(info); | 380 | framebuffer_release(info); |
381 | } | ||
382 | |||
379 | return ret; | 383 | return ret; |
380 | } | 384 | } |
381 | 385 | ||
@@ -395,6 +399,7 @@ static void gx1fb_remove(struct pci_dev *pdev) | |||
395 | iounmap(par->dc_regs); | 399 | iounmap(par->dc_regs); |
396 | release_mem_region(gx1_gx_base() + 0x8300, 0x100); | 400 | release_mem_region(gx1_gx_base() + 0x8300, 0x100); |
397 | 401 | ||
402 | fb_dealloc_cmap(&info->cmap); | ||
398 | pci_set_drvdata(pdev, NULL); | 403 | pci_set_drvdata(pdev, NULL); |
399 | 404 | ||
400 | framebuffer_release(info); | 405 | framebuffer_release(info); |