Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

be2iscsi : Fix the PCI request region reserving.

Reserve device PCI I/O and Memory resources.

Signed-off-by: John Soni Jose <sony.john-n@emulex.com>
Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Odin.com>

authored by

John Soni Jose and committed by
James Bottomley
e307f3ac 3efde862

+18 -4
+18 -4
drivers/scsi/be2iscsi/be_main.c
··· 668 668 return ret; 669 669 } 670 670 671 + ret = pci_request_regions(pcidev, DRV_NAME); 672 + if (ret) { 673 + dev_err(&pcidev->dev, 674 + "beiscsi_enable_pci - request region failed\n"); 675 + goto pci_dev_disable; 676 + } 677 + 671 678 pci_set_master(pcidev); 672 679 ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(64)); 673 680 if (ret) { 674 681 ret = pci_set_dma_mask(pcidev, DMA_BIT_MASK(32)); 675 682 if (ret) { 676 683 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n"); 677 - pci_disable_device(pcidev); 678 - return ret; 684 + goto pci_region_release; 679 685 } else { 680 686 ret = pci_set_consistent_dma_mask(pcidev, 681 687 DMA_BIT_MASK(32)); ··· 690 684 ret = pci_set_consistent_dma_mask(pcidev, DMA_BIT_MASK(64)); 691 685 if (ret) { 692 686 dev_err(&pcidev->dev, "Could not set PCI DMA Mask\n"); 693 - pci_disable_device(pcidev); 694 - return ret; 687 + goto pci_region_release; 695 688 } 696 689 } 697 690 return 0; 691 + 692 + pci_region_release: 693 + pci_release_regions(pcidev); 694 + pci_dev_disable: 695 + pci_disable_device(pcidev); 696 + 697 + return ret; 698 698 } 699 699 700 700 static int be_ctrl_init(struct beiscsi_hba *phba, struct pci_dev *pdev) ··· 5287 5275 iscsi_host_free(phba->shost); 5288 5276 pci_disable_pcie_error_reporting(pcidev); 5289 5277 pci_set_drvdata(pcidev, NULL); 5278 + pci_release_regions(pcidev); 5290 5279 pci_disable_device(pcidev); 5291 5280 } 5292 5281 ··· 5768 5755 iscsi_host_free(phba->shost); 5769 5756 pci_set_drvdata(pcidev, NULL); 5770 5757 disable_pci: 5758 + pci_release_regions(pcidev); 5771 5759 pci_disable_device(pcidev); 5772 5760 return ret; 5773 5761 }