ioremap balanced with iounmap for drivers/scsi/seagate.c
PATCH 18/36 ioremap balanced with iounmap for drivers/scsi/seagate.c
From: Amol Lad <[email protected]>
ioremap must be balanced by an iounmap and failing to do so can result in a memory leak.
Signed-off-by Amol Lad <[email protected]>
Cc James Bottomley <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
drivers/scsi/seagate.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-)
drivers/scsi/seagate.c renamed from drivers/scsi/seagate.c~ioremap-balanced-with-iounmap-drivers-scsi-seagatec +12 -1
@@ -494,12 +494,19 @@ int __init seagate_st0x_detect (struct s* if we lose our first interrupt. */ instance =scsi_register (tpnt,0 ); -if (instance ==NULL ) +if (instance ==NULL ) { +iounmap (st0x_cr_sr); +iounmap (st0x_dr); + st0x_cr_sr = st0x_dr =NULL ;return 0 ; + } hostno = instance->host_no;if (request_irq (irq, do_seagate_reconnect_intr,IRQF_DISABLED , (controller_type ==SEAGATE ) ?"seagate" :"tmc-8xx" , instance)) {printk (KERN_ERR "scsi%d : unable to allocate IRQ%d\n" , hostno, irq); +iounmap (st0x_cr_sr); +iounmap (st0x_dr); + st0x_cr_sr = st0x_dr =NULL ;return 0 ; } instance->irq = irq;
@@ -1646,6 +1653,10 @@ static int seagate_st0x_release(struct S {if (shost->irq)free_irq (shost->irq, shost); +if (st0x_cr_sr) +iounmap (st0x_cr_sr); +if (st0x_dr) +iounmap (st0x_dr);release_region (shost->io_port, shost->n_io_port);return 0 ; }
_