diff options
author | Amol Lad <amol@verismonetworks.com> | 2006-10-01 02:29:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:32 -0400 |
commit | f12ad7d59ab77591e4ab2dacd6faa9ea9afffb99 (patch) | |
tree | b7213b6cd80ae087076b4d1f99111be02797941d | |
parent | 16c564bb3cdecbc39eab5c0de3fe94ed58ba4163 (diff) |
[PATCH] ioremap balanced with iounmap for drivers/serial/8250_acorn,c
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.
Signed-off-by: Amol Lad <amol@verismonetworks.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/serial/8250_acorn.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/serial/8250_acorn.c b/drivers/serial/8250_acorn.c index 32af3650e8b4..ef8cc8a70c60 100644 --- a/drivers/serial/8250_acorn.c +++ b/drivers/serial/8250_acorn.c | |||
@@ -35,6 +35,7 @@ struct serial_card_type { | |||
35 | struct serial_card_info { | 35 | struct serial_card_info { |
36 | unsigned int num_ports; | 36 | unsigned int num_ports; |
37 | int ports[MAX_PORTS]; | 37 | int ports[MAX_PORTS]; |
38 | void __iomem *vaddr; | ||
38 | }; | 39 | }; |
39 | 40 | ||
40 | static int __devinit | 41 | static int __devinit |
@@ -44,7 +45,6 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
44 | struct serial_card_type *type = id->data; | 45 | struct serial_card_type *type = id->data; |
45 | struct uart_port port; | 46 | struct uart_port port; |
46 | unsigned long bus_addr; | 47 | unsigned long bus_addr; |
47 | unsigned char __iomem *virt_addr; | ||
48 | unsigned int i; | 48 | unsigned int i; |
49 | 49 | ||
50 | info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL); | 50 | info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL); |
@@ -55,8 +55,8 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
55 | info->num_ports = type->num_ports; | 55 | info->num_ports = type->num_ports; |
56 | 56 | ||
57 | bus_addr = ecard_resource_start(ec, type->type); | 57 | bus_addr = ecard_resource_start(ec, type->type); |
58 | virt_addr = ioremap(bus_addr, ecard_resource_len(ec, type->type)); | 58 | info->vaddr = ioremap(bus_addr, ecard_resource_len(ec, type->type)); |
59 | if (!virt_addr) { | 59 | if (!info->vaddr) { |
60 | kfree(info); | 60 | kfree(info); |
61 | return -ENOMEM; | 61 | return -ENOMEM; |
62 | } | 62 | } |
@@ -72,7 +72,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id) | |||
72 | port.dev = &ec->dev; | 72 | port.dev = &ec->dev; |
73 | 73 | ||
74 | for (i = 0; i < info->num_ports; i ++) { | 74 | for (i = 0; i < info->num_ports; i ++) { |
75 | port.membase = virt_addr + type->offset[i]; | 75 | port.membase = info->vaddr + type->offset[i]; |
76 | port.mapbase = bus_addr + type->offset[i]; | 76 | port.mapbase = bus_addr + type->offset[i]; |
77 | 77 | ||
78 | info->ports[i] = serial8250_register_port(&port); | 78 | info->ports[i] = serial8250_register_port(&port); |
@@ -92,6 +92,7 @@ static void __devexit serial_card_remove(struct expansion_card *ec) | |||
92 | if (info->ports[i] > 0) | 92 | if (info->ports[i] > 0) |
93 | serial8250_unregister_port(info->ports[i]); | 93 | serial8250_unregister_port(info->ports[i]); |
94 | 94 | ||
95 | iounmap(info->vaddr); | ||
95 | kfree(info); | 96 | kfree(info); |
96 | } | 97 | } |
97 | 98 | ||