diff options
-rw-r--r-- | drivers/video/amba-clcd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index 4e046fed1380..61050ab14128 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -408,7 +408,9 @@ static int clcdfb_register(struct clcd_fb *fb) | |||
408 | /* | 408 | /* |
409 | * Allocate colourmap. | 409 | * Allocate colourmap. |
410 | */ | 410 | */ |
411 | fb_alloc_cmap(&fb->fb.cmap, 256, 0); | 411 | ret = fb_alloc_cmap(&fb->fb.cmap, 256, 0); |
412 | if (ret) | ||
413 | goto unmap; | ||
412 | 414 | ||
413 | /* | 415 | /* |
414 | * Ensure interrupts are disabled. | 416 | * Ensure interrupts are disabled. |
@@ -426,6 +428,8 @@ static int clcdfb_register(struct clcd_fb *fb) | |||
426 | 428 | ||
427 | printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); | 429 | printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); |
428 | 430 | ||
431 | fb_dealloc_cmap(&fb->fb.cmap); | ||
432 | unmap: | ||
429 | iounmap(fb->regs); | 433 | iounmap(fb->regs); |
430 | free_clk: | 434 | free_clk: |
431 | clk_put(fb->clk); | 435 | clk_put(fb->clk); |
@@ -485,6 +489,8 @@ static int clcdfb_remove(struct amba_device *dev) | |||
485 | 489 | ||
486 | clcdfb_disable(fb); | 490 | clcdfb_disable(fb); |
487 | unregister_framebuffer(&fb->fb); | 491 | unregister_framebuffer(&fb->fb); |
492 | if (fb->fb.cmap.len) | ||
493 | fb_dealloc_cmap(&fb->fb.cmap); | ||
488 | iounmap(fb->regs); | 494 | iounmap(fb->regs); |
489 | clk_put(fb->clk); | 495 | clk_put(fb->clk); |
490 | 496 | ||