Skip to contentSkip to conversation

ioremap balanced with iounmap for drivers/scsi/3w-9xxx.c

PATCH In review [email protected] 2 participants 2 messages Oct 10, 2006 – Oct 18, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 24/36 ioremap balanced with iounmap for drivers/scsi/3w-9xxx.c

From: Amol Lad <[email protected]>

ioremap must be balanced by an iounmap and failing to do so can result in a memory leak.

Cc James Bottomley <[email protected]>
Cc adam radford <[email protected]>

---

 drivers/scsi/3w-9xxx.c |    5 +++++
 1 files changed, 5 insertions(+)
drivers/scsi/3w-9xxx.c renamed from drivers/scsi/3w-9xxx.c~ioremap-balanced-with-iounmap-drivers-scsi-3w-9xxxc +5 -0
diff -puN drivers/scsi/3w-9xxx.c~ioremap-balanced-with-iounmap-drivers-scsi-3w-9xxxc drivers/scsi/3w-9xxx.c
@@ -2147,6 +2147,8 @@ out_remove_host:
 	scsi_remove_host(host);
 out_release_mem_region:
 	pci_release_regions(pdev);
+	if (tw_dev->base_addr)
+		iounmap(tw_dev->base_addr);
 out_free_device_extension:
 	twa_free_device_extension(tw_dev);
 	scsi_host_put(host);
@@ -2173,6 +2175,9 @@ static void twa_remove(struct pci_dev *p
 	/* Free up the IRQ */
 	free_irq(tw_dev->tw_pci_dev->irq, tw_dev);
 
+	/* Free IO mem */
+	iounmap(tw_dev->base_addr);
+
 	/* Shutdown the card */
 	__twa_shutdown(tw_dev);
 

_

maintainer
#1 lore raw
Quoted 30 lines · On 10/10/06, [email protected] <[email protected]> wrote:

From: Amol Lad <[email protected]>

ioremap must be balanced by an iounmap and failing to do so can result in a memory leak.

 drivers/scsi/3w-9xxx.c |    5 +++++
 1 files changed, 5 insertions(+)

diff -puN drivers/scsi/3w-9xxx.c~ioremap-balanced-with-iounmap-drivers-scsi-3w-9xxxc drivers/scsi/3w-9xxx.c

drivers/scsi/3w-9xxx.c renamed from drivers/scsi/3w-9xxx.c~ioremap-balanced-with-iounmap-drivers-scsi-3w-9xxxc +5 -0
@@ -2147,6 +2147,8 @@ out_remove_host:
        scsi_remove_host(host);
 out_release_mem_region:
        pci_release_regions(pdev);
+       if (tw_dev->base_addr)
+               iounmap(tw_dev->base_addr);
 out_free_device_extension:
        twa_free_device_extension(tw_dev);
        scsi_host_put(host);
@@ -2173,6 +2175,9 @@ static void twa_remove(struct pci_dev *p
        /* Free up the IRQ */
        free_irq(tw_dev->tw_pci_dev->irq, tw_dev);
 
+       /* Free IO mem */
+       iounmap(tw_dev->base_addr);
+
        /* Shutdown the card */
        __twa_shutdown(tw_dev);
 
Quoted 2 lines

_

NAK... The second iounmap() call is placed incorrectly. __twa_shutdown() is called after that, and it still needs to use the registers. I'll roll a corrected
patch into my next update.

-Adam