diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-05-27 16:13:22 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:01:07 -0400 |
commit | 204892e9717790cd17689aaebf2790a477492734 (patch) | |
tree | 0a20aaa32ead35fa9fb75f187d742e1b2e310c81 /drivers/scsi/hpsa.c | |
parent | 77c4495c17d7508bdef1cfd2c3c933ff5379908b (diff) |
[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.c | 13 |
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) | |||
3379 | if (err) | 3379 | if (err) |
3380 | goto err_out_free_res; | 3380 | goto err_out_free_res; |
3381 | h->vaddr = remap_pci_mem(h->paddr, 0x250); | 3381 | h->vaddr = remap_pci_mem(h->paddr, 0x250); |
3382 | 3382 | if (!h->vaddr) { | |
3383 | err = -ENOMEM; | ||
3384 | goto err_out_free_res; | ||
3385 | } | ||
3383 | err = hpsa_wait_for_board_ready(h); | 3386 | err = hpsa_wait_for_board_ready(h); |
3384 | if (err) | 3387 | if (err) |
3385 | goto err_out_free_res; | 3388 | goto err_out_free_res; |
@@ -3466,6 +3469,12 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h) | |||
3466 | return 0; | 3469 | return 0; |
3467 | 3470 | ||
3468 | err_out_free_res: | 3471 | err_out_free_res: |
3472 | if (h->transtable) | ||
3473 | iounmap(h->transtable); | ||
3474 | if (h->cfgtable) | ||
3475 | iounmap(h->cfgtable); | ||
3476 | if (h->vaddr) | ||
3477 | iounmap(h->vaddr); | ||
3469 | /* | 3478 | /* |
3470 | * Deliberately omit pci_disable_device(): it does something nasty to | 3479 | * Deliberately omit pci_disable_device(): it does something nasty to |
3471 | * Smart Array controllers that pci_enable_device does not undo | 3480 | * Smart Array controllers that pci_enable_device does not undo |
@@ -3684,6 +3693,8 @@ static void __devexit hpsa_remove_one(struct pci_dev *pdev) | |||
3684 | hpsa_unregister_scsi(h); /* unhook from SCSI subsystem */ | 3693 | hpsa_unregister_scsi(h); /* unhook from SCSI subsystem */ |
3685 | hpsa_shutdown(pdev); | 3694 | hpsa_shutdown(pdev); |
3686 | iounmap(h->vaddr); | 3695 | iounmap(h->vaddr); |
3696 | iounmap(h->transtable); | ||
3697 | iounmap(h->cfgtable); | ||
3687 | hpsa_free_sg_chain_blocks(h); | 3698 | hpsa_free_sg_chain_blocks(h); |
3688 | pci_free_consistent(h->pdev, | 3699 | pci_free_consistent(h->pdev, |
3689 | h->nr_cmds * sizeof(struct CommandList), | 3700 | h->nr_cmds * sizeof(struct CommandList), |