diff options
Diffstat (limited to 'drivers/video/geode/gxfb_core.c')
-rw-r--r-- | drivers/video/geode/gxfb_core.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c index 484118926318..2552cac39e1c 100644 --- a/drivers/video/geode/gxfb_core.c +++ b/drivers/video/geode/gxfb_core.c | |||
@@ -171,13 +171,10 @@ static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
171 | 171 | ||
172 | static int gxfb_set_par(struct fb_info *info) | 172 | static int gxfb_set_par(struct fb_info *info) |
173 | { | 173 | { |
174 | if (info->var.bits_per_pixel > 8) { | 174 | if (info->var.bits_per_pixel > 8) |
175 | info->fix.visual = FB_VISUAL_TRUECOLOR; | 175 | info->fix.visual = FB_VISUAL_TRUECOLOR; |
176 | fb_dealloc_cmap(&info->cmap); | 176 | else |
177 | } else { | ||
178 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; | 177 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; |
179 | fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0); | ||
180 | } | ||
181 | 178 | ||
182 | info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel); | 179 | info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel); |
183 | 180 | ||
@@ -331,6 +328,11 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev) | |||
331 | 328 | ||
332 | info->var.grayscale = 0; | 329 | info->var.grayscale = 0; |
333 | 330 | ||
331 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | ||
332 | framebuffer_release(info); | ||
333 | return NULL; | ||
334 | } | ||
335 | |||
334 | return info; | 336 | return info; |
335 | } | 337 | } |
336 | 338 | ||
@@ -443,8 +445,10 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
443 | pci_release_region(pdev, 1); | 445 | pci_release_region(pdev, 1); |
444 | } | 446 | } |
445 | 447 | ||
446 | if (info) | 448 | if (info) { |
449 | fb_dealloc_cmap(&info->cmap); | ||
447 | framebuffer_release(info); | 450 | framebuffer_release(info); |
451 | } | ||
448 | return ret; | 452 | return ret; |
449 | } | 453 | } |
450 | 454 | ||
@@ -467,6 +471,7 @@ static void gxfb_remove(struct pci_dev *pdev) | |||
467 | iounmap(par->gp_regs); | 471 | iounmap(par->gp_regs); |
468 | pci_release_region(pdev, 1); | 472 | pci_release_region(pdev, 1); |
469 | 473 | ||
474 | fb_dealloc_cmap(&info->cmap); | ||
470 | pci_set_drvdata(pdev, NULL); | 475 | pci_set_drvdata(pdev, NULL); |
471 | 476 | ||
472 | framebuffer_release(info); | 477 | framebuffer_release(info); |