Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Dominik Brodowski and committed by
Linus Torvalds
2e5a3e79 dc33a4a3

+29 -22
+29 -22
drivers/pcmcia/cistpl.c
··· 88 88 static void __iomem * 89 89 set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) 90 90 { 91 - pccard_mem_map *mem = &s->cis_mem; 92 - int ret; 91 + pccard_mem_map *mem = &s->cis_mem; 92 + int ret; 93 93 94 - if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { 95 - mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 96 - if (mem->res == NULL) { 97 - printk(KERN_NOTICE "cs: unable to map card memory!\n"); 98 - return NULL; 94 + if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) { 95 + mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 96 + if (mem->res == NULL) { 97 + printk(KERN_NOTICE "cs: unable to map card memory!\n"); 98 + return NULL; 99 + } 100 + s->cis_virt = NULL; 99 101 } 100 - s->cis_virt = ioremap(mem->res->start, s->map_size); 101 - } 102 - mem->card_start = card_offset; 103 - mem->flags = flags; 104 - ret = s->ops->set_mem_map(s, mem); 105 - if (ret) { 106 - iounmap(s->cis_virt); 107 - return NULL; 108 - } 109 102 110 - if (s->features & SS_CAP_STATIC_MAP) { 111 - if (s->cis_virt) 112 - iounmap(s->cis_virt); 113 - s->cis_virt = ioremap(mem->static_start, s->map_size); 114 - } 115 - return s->cis_virt; 103 + if (!(s->features & SS_CAP_STATIC_MAP) && (!s->cis_virt)) 104 + s->cis_virt = ioremap(mem->res->start, s->map_size); 105 + 106 + mem->card_start = card_offset; 107 + mem->flags = flags; 108 + 109 + ret = s->ops->set_mem_map(s, mem); 110 + if (ret) { 111 + iounmap(s->cis_virt); 112 + s->cis_virt = NULL; 113 + return NULL; 114 + } 115 + 116 + if (s->features & SS_CAP_STATIC_MAP) { 117 + if (s->cis_virt) 118 + iounmap(s->cis_virt); 119 + s->cis_virt = ioremap(mem->static_start, s->map_size); 120 + } 121 + 122 + return s->cis_virt; 116 123 } 117 124 118 125 /*======================================================================