From 6792951b6ad13d7b2fff71ae7d2982b2fa1d6788 Mon Sep 17 00:00:00 2001 From: Amol Lad Date: Fri, 8 Dec 2006 02:40:15 -0800 Subject: [PATCH] [PATCH] ioremap balanced with iounmap for drivers/video/atafb 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" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/video/atafb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 02c41a626fa2..602db660bc73 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c @@ -2804,8 +2804,19 @@ int __init atafb_init(void) atafb_set_disp(-1, &fb_info); do_install_cmap(0, &fb_info); - if (register_framebuffer(&fb_info) < 0) + if (register_framebuffer(&fb_info) < 0) { +#ifdef ATAFB_EXT + if (external_addr) { + iounmap(external_addr); + external_addr = NULL; + } + if (external_vgaiobase) { + iounmap((void*)external_vgaiobase); + external_vgaiobase = 0; + } +#endif return -EINVAL; + } printk("Determined %dx%d, depth %d\n", disp.var.xres, disp.var.yres, disp.var.bits_per_pixel);