diff options
author | Andres Salomon <dilinger@queued.net> | 2009-04-01 00:25:29 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 17:59:31 +0200 |
commit | 909baf0092545e5c2082b045303e7a4b1d2a0522 (patch) | |
tree | 03af508a13bcd9cf2b41be2bfe4ae5a950f230bd /drivers/video/amba-clcd.c | |
parent | 68328fb: fix cmap memory leaks (diff) | |
download | linux-909baf0092545e5c2082b045303e7a4b1d2a0522.tar.xz linux-909baf0092545e5c2082b045303e7a4b1d2a0522.zip |
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/amba-clcd.c')
-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) /* * Allocate colourmap. */ - fb_alloc_cmap(&fb->fb.cmap, 256, 0); + ret = fb_alloc_cmap(&fb->fb.cmap, 256, 0); + if (ret) + goto unmap; /* * Ensure interrupts are disabled. @@ -426,6 +428,8 @@ static int clcdfb_register(struct clcd_fb *fb) printk(KERN_ERR "CLCD: cannot register framebuffer (%d)\n", ret); + fb_dealloc_cmap(&fb->fb.cmap); + unmap: iounmap(fb->regs); free_clk: clk_put(fb->clk); @@ -485,6 +489,8 @@ static int clcdfb_remove(struct amba_device *dev) clcdfb_disable(fb); unregister_framebuffer(&fb->fb); + if (fb->fb.cmap.len) + fb_dealloc_cmap(&fb->fb.cmap); iounmap(fb->regs); clk_put(fb->clk); |