Fusion MPT: disable pci device when mpt map resoures failed
Subsystems (2)
RFC PATCH 1/1 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.
--- drivers/message/fusion/mptbase.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
drivers/message/fusion/mptbase.c +11 -7
@@ -1666,7 +1666,7 @@ mpt_mapresources(MPT_ADAPTER *ioc)if (pci_request_selected_regions (pdev, ioc->bars,"mpt" )) {printk (MYIOC_s_ERR_FMT"pci_request_selected_regions() with " "MEM failed\n" , ioc->name); -return r; + goto out_pci_disable_device; }if (sizeof (dma_addr_t) >4 ) {
@@ -1690,8 +1690,7 @@ mpt_mapresources(MPT_ADAPTER *ioc) }else {printk (MYIOC_s_WARN_FMT"no suitable DMA mask for %s\n" , ioc->name,pci_name (pdev)); -pci_release_selected_regions (pdev, ioc->bars); -return r; + goto out_pci_release_region; } }else { if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
@@ -1704,8 +1703,7 @@ mpt_mapresources(MPT_ADAPTER *ioc) }else {printk (MYIOC_s_WARN_FMT"no suitable DMA mask for %s\n" , ioc->name,pci_name (pdev)); -pci_release_selected_regions (pdev, ioc->bars); -return r; + goto out_pci_release_region; } }
@@ -1735,8 +1733,8 @@ mpt_mapresources(MPT_ADAPTER *ioc)if (mem ==NULL ) {printk (MYIOC_s_ERR_FMT": ERROR - Unable to map adapter" " memory!\n" , ioc->name); -pci_release_selected_regions (pdev, ioc->bars); -return -EINVAL ; + r = -EINVAL ; + goto out_pci_release_region; } ioc->memmap = mem; dinitprintk(ioc, printk(MYIOC_s_INFO_FMT "mem = %p, mem_phys = %llx\n",
@@ -1750,6 +1748,12 @@ mpt_mapresources(MPT_ADAPTER *ioc) ioc->pio_chip = (SYSIF_REGS __iomem *)port;return 0 ; + +out_pci_release_region: +pci_release_selected_regions (pdev, ioc->bars); +out_pci_disable_device: +pci_disable_device (pdev); +return r; }/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
Signature · 1 line
1.7.6.1
Quoted 9 lines · Hanjun Guo
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.
Quoted 5 lines
Signed-off-by Hanjun Guo <[email protected]>Signed-off-by Jiang Liu <[email protected]>--- drivers/message/fusion/mptbase.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
You may need to send to LSI and scsi list.
You need to use ./scripts/get_maintainer.pl to find out right CC list.
Thanks
Yinghai
Quoted 16 lines · Yinghai Lu
Quoted 9 lines · Hanjun Guo
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.Quoted 5 lines
Signed-off-by Hanjun Guo <[email protected]>Signed-off-by Jiang Liu <[email protected]>--- drivers/message/fusion/mptbase.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
Quoted 7 lines
You may need to send to LSI and scsi list.
You need to use
./scripts/get_maintainer.plto find out right CC list.Thanks
Yinghai
Hi Yinghai,
Thanks for your help, I really appreciate it.
I will resend this patch with the right CC list.
Thanks,
Hanjun Guo