aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2009-03-31 18:25:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:31 -0400
commit909baf0092545e5c2082b045303e7a4b1d2a0522 (patch)
tree03af508a13bcd9cf2b41be2bfe4ae5a950f230bd /drivers/video
parente98d9b407c248ba1419bed0823488d3cc71a2c31 (diff)
amba-clcd: fix cmap memory leaks
- fix cmap leak in removal path - fix cmap leak when register_framebuffer fails Signed-off-by: Andres Salomon <dilinger@debian.org> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/amba-clcd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index 4e046fed138..61050ab1412 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