diff options
author | Andres Salomon <dilinger@queued.net> | 2009-03-31 15:25:29 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 08:59:31 -0700 |
commit | 909baf0092545e5c2082b045303e7a4b1d2a0522 (patch) | |
tree | 03af508a13bcd9cf2b41be2bfe4ae5a950f230bd | |
parent | e98d9b407c248ba1419bed0823488d3cc71a2c31 (diff) | |
download | linux-3.10-909baf0092545e5c2082b045303e7a4b1d2a0522.tar.gz linux-3.10-909baf0092545e5c2082b045303e7a4b1d2a0522.tar.bz2 linux-3.10-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>
-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 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) /* * 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); |