aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorHanjun Guo <guohanjun@huawei.com>2012-08-10 22:58:36 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-09-14 12:59:29 -0400
commit20953a6277c91d5edf2e494ba5035d07ff4d1885 (patch)
tree2be77bed9f4a93f3c8cba3c5ded27bac8e92f9d4 /drivers/message
parent6ed33a4a0b86da42638b5f6a0bb9f9f9aee89f60 (diff)
[SCSI] Fusion MPT: disable pci device when mpt map resoures failed
when probe a pci device, first we enable it, and disable it when some error happened in the following process, because the power state of the device is set to D0, and if MSI is disabled, we will allocate irq and register gsi for this device in the enable process. In function mpt_mapresources(MPT_ADAPTER *ioc), it forgot disable the pci device when error happened, the irq and gsi will never be released. this patch will fix it. Signed-off-by: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: "Nandigama, Nagalakshmi" <Nagalakshmi.Nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptbase.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index d99db5623acf..fb69baa06ca8 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1666,7 +1666,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1666 if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) { 1666 if (pci_request_selected_regions(pdev, ioc->bars, "mpt")) {
1667 printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with " 1667 printk(MYIOC_s_ERR_FMT "pci_request_selected_regions() with "
1668 "MEM failed\n", ioc->name); 1668 "MEM failed\n", ioc->name);
1669 return r; 1669 goto out_pci_disable_device;
1670 } 1670 }
1671 1671
1672 if (sizeof(dma_addr_t) > 4) { 1672 if (sizeof(dma_addr_t) > 4) {
@@ -1690,8 +1690,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1690 } else { 1690 } else {
1691 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", 1691 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n",
1692 ioc->name, pci_name(pdev)); 1692 ioc->name, pci_name(pdev));
1693 pci_release_selected_regions(pdev, ioc->bars); 1693 goto out_pci_release_region;
1694 return r;
1695 } 1694 }
1696 } else { 1695 } else {
1697 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) 1696 if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
@@ -1704,8 +1703,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1704 } else { 1703 } else {
1705 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n", 1704 printk(MYIOC_s_WARN_FMT "no suitable DMA mask for %s\n",
1706 ioc->name, pci_name(pdev)); 1705 ioc->name, pci_name(pdev));
1707 pci_release_selected_regions(pdev, ioc->bars); 1706 goto out_pci_release_region;
1708 return r;
1709 } 1707 }
1710 } 1708 }
1711 1709
@@ -1735,8 +1733,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1735 if (mem == NULL) { 1733 if (mem == NULL) {
1736 printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter" 1734 printk(MYIOC_s_ERR_FMT ": ERROR - Unable to map adapter"
1737 " memory!\n", ioc->name); 1735 " memory!\n", ioc->name);
1738 pci_release_selected_regions(pdev, ioc->bars); 1736 r = -EINVAL;
1739 return -EINVAL; 1737 goto out_pci_release_region;
1740 } 1738 }
1741 ioc->memmap = mem; 1739 ioc->memmap = mem;
1742 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n", 1740 dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n",
@@ -1750,6 +1748,12 @@ mpt_mapresources(MPT_ADAPTER *ioc)
1750 ioc->pio_chip = (SYSIF_REGS __iomem *)port; 1748 ioc->pio_chip = (SYSIF_REGS __iomem *)port;
1751 1749
1752 return 0; 1750 return 0;
1751
1752out_pci_release_region:
1753 pci_release_selected_regions(pdev, ioc->bars);
1754out_pci_disable_device:
1755 pci_disable_device(pdev);
1756 return r;
1753} 1757}
1754 1758
1755/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1759/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/