[PATCH] ioremap balanced with iounmap for drivers/pcmcia
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> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
a230a6785d
commit
3efa9970bd
@ -310,9 +310,10 @@ static int __init at91_cf_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail2:
|
fail2:
|
||||||
iounmap((void __iomem *) cf->socket.io_offset);
|
|
||||||
release_mem_region(io->start, io->end + 1 - io->start);
|
release_mem_region(io->start, io->end + 1 - io->start);
|
||||||
fail1:
|
fail1:
|
||||||
|
if (cf->socket.io_offset)
|
||||||
|
iounmap((void __iomem *) cf->socket.io_offset);
|
||||||
if (board->irq_pin)
|
if (board->irq_pin)
|
||||||
free_irq(board->irq_pin, cf);
|
free_irq(board->irq_pin, cf);
|
||||||
fail0a:
|
fail0a:
|
||||||
|
@ -449,6 +449,16 @@ out_err:
|
|||||||
del_timer_sync(&skt->poll_timer);
|
del_timer_sync(&skt->poll_timer);
|
||||||
pcmcia_unregister_socket(&skt->socket);
|
pcmcia_unregister_socket(&skt->socket);
|
||||||
flush_scheduled_work();
|
flush_scheduled_work();
|
||||||
|
if (i == 0) {
|
||||||
|
iounmap(skt->virt_io + (u32)mips_io_port_base);
|
||||||
|
skt->virt_io = NULL;
|
||||||
|
}
|
||||||
|
#ifndef CONFIG_MIPS_XXS1500
|
||||||
|
else {
|
||||||
|
iounmap(skt->virt_io + (u32)mips_io_port_base);
|
||||||
|
skt->virt_io = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ops->hw_shutdown(skt);
|
ops->hw_shutdown(skt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ static int voltage_set(int slot, int vcc, int vpp)
|
|||||||
reg |= BCSR1_PCCVCC1;
|
reg |= BCSR1_PCCVCC1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return 1;
|
goto out_unmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(vpp) {
|
switch(vpp) {
|
||||||
@ -438,15 +438,15 @@ static int voltage_set(int slot, int vcc, int vpp)
|
|||||||
if(vcc == vpp)
|
if(vcc == vpp)
|
||||||
reg |= BCSR1_PCCVPP1;
|
reg |= BCSR1_PCCVPP1;
|
||||||
else
|
else
|
||||||
return 1;
|
goto out_unmap;
|
||||||
break;
|
break;
|
||||||
case 120:
|
case 120:
|
||||||
if ((vcc == 33) || (vcc == 50))
|
if ((vcc == 33) || (vcc == 50))
|
||||||
reg |= BCSR1_PCCVPP0;
|
reg |= BCSR1_PCCVPP0;
|
||||||
else
|
else
|
||||||
return 1;
|
goto out_unmap;
|
||||||
default:
|
default:
|
||||||
return 1;
|
goto out_unmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* first, turn off all power */
|
/* first, turn off all power */
|
||||||
@ -457,6 +457,10 @@ static int voltage_set(int slot, int vcc, int vpp)
|
|||||||
|
|
||||||
iounmap(bcsr_io);
|
iounmap(bcsr_io);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
out_unmap:
|
||||||
|
iounmap(bcsr_io);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
|
#define socket_get(_slot_) PCMCIA_SOCKET_KEY_5V
|
||||||
|
@ -309,9 +309,10 @@ static int __devinit omap_cf_probe(struct device *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail2:
|
fail2:
|
||||||
iounmap((void __iomem *) cf->socket.io_offset);
|
|
||||||
release_mem_region(cf->phys_cf, SZ_8K);
|
release_mem_region(cf->phys_cf, SZ_8K);
|
||||||
fail1:
|
fail1:
|
||||||
|
if (cf->socket.io_offset)
|
||||||
|
iounmap((void __iomem *) cf->socket.io_offset);
|
||||||
free_irq(irq, cf);
|
free_irq(irq, cf);
|
||||||
fail0:
|
fail0:
|
||||||
kfree(cf);
|
kfree(cf);
|
||||||
|
Loading…
Reference in New Issue
Block a user