Commit ef26dd7f authored by Amol Lad's avatar Amol Lad Committed by Linus Torvalds

[PATCH] ioremap balanced with iounmap for drivers/video/virgefb

ioremap must be balanced by an iounmap and failing to do so can result in a
memory leak.
Signed-off-by: default avatarAmol Lad <amol@verismonetworks.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dd607d23
...@@ -1799,7 +1799,7 @@ int __init virgefb_init(void) ...@@ -1799,7 +1799,7 @@ int __init virgefb_init(void)
#warning release resources #warning release resources
printk(KERN_ERR "virgefb.c: register_framebuffer failed\n"); printk(KERN_ERR "virgefb.c: register_framebuffer failed\n");
DPRINTK("EXIT\n"); DPRINTK("EXIT\n");
return -EINVAL; goto out_unmap;
} }
printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n", printk(KERN_INFO "fb%d: %s frame buffer device, using %ldK of video memory\n",
...@@ -1809,6 +1809,21 @@ int __init virgefb_init(void) ...@@ -1809,6 +1809,21 @@ int __init virgefb_init(void)
DPRINTK("EXIT\n"); DPRINTK("EXIT\n");
return 0; return 0;
out_unmap:
if (board_addr >= 0x01000000) {
if (v_ram)
iounmap((void*)v_ram);
if (vgaio_regs)
iounmap(vgaio_regs);
if (mmio_regs)
iounmap(mmio_regs);
if (vcode_switch_base)
iounmap((void*)vcode_switch_base);
v_ram = vcode_switch_base = 0;
vgaio_regs = mmio_regs = NULL;
}
return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment