Commit 2e5a3e79 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: avoid duble iounmap of one address

Avoid double iounmap of one address, and disable cis_virt if set_mem_map
failed.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dc33a4a3
...@@ -91,19 +91,25 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag ...@@ -91,19 +91,25 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
pccard_mem_map *mem = &s->cis_mem; pccard_mem_map *mem = &s->cis_mem;
int ret; int ret;
if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) {
mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s);
if (mem->res == NULL) { if (mem->res == NULL) {
printk(KERN_NOTICE "cs: unable to map card memory!\n"); printk(KERN_NOTICE "cs: unable to map card memory!\n");
return NULL; return NULL;
} }
s->cis_virt = ioremap(mem->res->start, s->map_size); s->cis_virt = NULL;
} }
if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt))
s->cis_virt = ioremap(mem->res->start, s->map_size);
mem->card_start = card_offset; mem->card_start = card_offset;
mem->flags = flags; mem->flags = flags;
ret = s->ops->set_mem_map(s, mem); ret = s->ops->set_mem_map(s, mem);
if (ret) { if (ret) {
iounmap(s->cis_virt); iounmap(s->cis_virt);
s->cis_virt = NULL;
return NULL; return NULL;
} }
...@@ -112,6 +118,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag ...@@ -112,6 +118,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
iounmap(s->cis_virt); iounmap(s->cis_virt);
s->cis_virt = ioremap(mem->static_start, s->map_size); s->cis_virt = ioremap(mem->static_start, s->map_size);
} }
return s->cis_virt; return s->cis_virt;
} }
......
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