From 164a765b9895f4f80f91cb7f1aab7539b3f8d335 Mon Sep 17 00:00:00 2001 From: Amol Lad Date: Fri, 8 Dec 2006 02:40:09 -0800 Subject: [PATCH] ioremap balanced with iounmap for drivers/video/macfb ioremap must be balanced by an iounmap and failing to do so can result in a memory leak. Signed-off-by: Amol Lad Cc: "Antonino A. Daplas" Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/macfb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers') diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c index 80a04380716..180d94c2b4d 100644 --- a/drivers/video/macfb.c +++ b/drivers/video/macfb.c @@ -608,6 +608,22 @@ void __init macfb_setup(char *options) } } +static void __init iounmap_macfb(void) +{ + if (valkyrie_cmap_regs) + iounmap(valkyrie_cmap_regs); + if (dafb_cmap_regs) + iounmap(dafb_cmap_regs); + if (v8_brazil_cmap_regs) + iounmap(v8_brazil_cmap_regs); + if (rbv_cmap_regs) + iounmap(rbv_cmap_regs); + if (civic_cmap_regs) + iounmap(civic_cmap_regs); + if (csc_cmap_regs) + iounmap(csc_cmap_regs); +} + static int __init macfb_init(void) { int video_cmap_len, video_is_nubus = 0; @@ -962,6 +978,10 @@ static int __init macfb_init(void) if (!err) printk("fb%d: %s frame buffer device\n", fb_info.node, fb_info.fix.id); + else { + iounmap(fb_info.screen_base); + iounmap_macfb(); + } return err; } -- cgit v1.2.3