summaryrefslogtreecommitdiff
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-05-27 15:13:22 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 12:01:07 -0500
commit204892e9717790cd17689aaebf2790a477492734 (patch)
tree0a20aaa32ead35fa9fb75f187d742e1b2e310c81 /drivers/scsi/hpsa.c
parent77c4495c17d7508bdef1cfd2c3c933ff5379908b (diff)
downloadlwn-204892e9717790cd17689aaebf2790a477492734.tar.gz
lwn-204892e9717790cd17689aaebf2790a477492734.zip
[SCSI] hpsa: fix leak of ioremapped memory in hpsa_pci_init error path.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index cb0cc0993b9c..4983f3452dc4 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3379,7 +3379,10 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
if (err)
goto err_out_free_res;
h->vaddr = remap_pci_mem(h->paddr, 0x250);
-
+ if (!h->vaddr) {
+ err = -ENOMEM;
+ goto err_out_free_res;
+ }
err = hpsa_wait_for_board_ready(h);
if (err)
goto err_out_free_res;
@@ -3466,6 +3469,12 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
return 0;
err_out_free_res:
+ if (h->transtable)
+ iounmap(h->transtable);
+ if (h->cfgtable)
+ iounmap(h->cfgtable);
+ if (h->vaddr)
+ iounmap(h->vaddr);
/*
* Deliberately omit pci_disable_device(): it does something nasty to
* Smart Array controllers that pci_enable_device does not undo
@@ -3684,6 +3693,8 @@ static void __devexit hpsa_remove_one(struct pci_dev *pdev)
hpsa_unregister_scsi(h); /* unhook from SCSI subsystem */
hpsa_shutdown(pdev);
iounmap(h->vaddr);
+ iounmap(h->transtable);
+ iounmap(h->cfgtable);
hpsa_free_sg_chain_blocks(h);
pci_free_consistent(h->pdev,
h->nr_cmds * sizeof(struct CommandList),