Commit e307f3ac authored by John Soni Jose's avatar John Soni Jose Committed by James Bottomley

be2iscsi : Fix the PCI request region reserving.

 Reserve device PCI I/O and Memory resources.
Signed-off-by: default avatarJohn Soni Jose <sony.john-n@emulex.com>
Signed-off-by: default avatarJayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent 3efde862
...@@ -668,14 +668,20 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev) ...@@ -668,14 +668,20 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev)
return ret; return ret;
} }
ret = pci_request_regions(pcidev, DRV_NAME);
if (ret) {
dev_err(&pcidev->dev,
"beiscsi_enable_pci - request region failed\n");
goto pci_dev_disable;
}
pci_set_master(pcidev); pci_set_master(pcidev);
ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64)); ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64));
if (ret) { if (ret) {
ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)); ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32));
if (ret) { if (ret) {
dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n"); dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
pci_disable_device(pcidev); goto pci_region_release;
return ret;
} else { } else {
ret = pci_set_consistent_dma_mask(pcidev, ret = pci_set_consistent_dma_mask(pcidev,
DMA_BIT_MASK(32)); DMA_BIT_MASK(32));
...@@ -684,11 +690,17 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev) ...@@ -684,11 +690,17 @@ static int beiscsi_enable_pci(struct pci_dev *pcidev)
ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64)); ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64));
if (ret) { if (ret) {
dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n"); dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n");
pci_disable_device(pcidev); goto pci_region_release;
return ret;
} }
} }
return 0; return 0;
pci_region_release:
pci_release_regions(pcidev);
pci_dev_disable:
pci_disable_device(pcidev);
return ret;
} }
static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev) static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev)
...@@ -5275,6 +5287,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) ...@@ -5275,6 +5287,7 @@ static void beiscsi_remove(struct pci_dev *pcidev)
iscsi_host_free(phba->shost); iscsi_host_free(phba->shost);
pci_disable_pcie_error_reporting(pcidev); pci_disable_pcie_error_reporting(pcidev);
pci_set_drvdata(pcidev, NULL); pci_set_drvdata(pcidev, NULL);
pci_release_regions(pcidev);
pci_disable_device(pcidev); pci_disable_device(pcidev);
} }
...@@ -5755,6 +5768,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, ...@@ -5755,6 +5768,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
iscsi_host_free(phba->shost); iscsi_host_free(phba->shost);
pci_set_drvdata(pcidev, NULL); pci_set_drvdata(pcidev, NULL);
disable_pci: disable_pci:
pci_release_regions(pcidev);
pci_disable_device(pcidev); pci_disable_device(pcidev);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment