diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2019-03-07 00:33:44 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-03-14 07:01:36 -0400 |
commit | 3a487ff78c4b2bf5686dbb29178cfd78b3eed053 (patch) | |
tree | 04a80d647471e8ec727fa5b23007d9b7122d2233 | |
parent | a656183e6c58a3a4d818278afab522b30a17014c (diff) |
scsi: lpfc: Fix error codes in lpfc_sli4_pci_mem_setup()
It used to be that "error" was set to -ENODEV at the start of the function
but we shifted some code around an now "error" is set to zero for most
error paths. There is a mix of direct returns and "goto out" but I changed
everything to direct returns for consistency.
Fixes: 56de8357049c ("scsi: lpfc: fix calls to dma_set_mask_and_coherent()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: James SmartĀ <james.smart@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 707dbe7a8d15..bbc2815fc012 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -10049,7 +10049,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10049 | { | 10049 | { |
10050 | struct pci_dev *pdev = phba->pcidev; | 10050 | struct pci_dev *pdev = phba->pcidev; |
10051 | unsigned long bar0map_len, bar1map_len, bar2map_len; | 10051 | unsigned long bar0map_len, bar1map_len, bar2map_len; |
10052 | int error = -ENODEV; | 10052 | int error; |
10053 | uint32_t if_type; | 10053 | uint32_t if_type; |
10054 | 10054 | ||
10055 | if (!pdev) | 10055 | if (!pdev) |
@@ -10066,7 +10066,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10066 | */ | 10066 | */ |
10067 | if (pci_read_config_dword(pdev, LPFC_SLI_INTF, | 10067 | if (pci_read_config_dword(pdev, LPFC_SLI_INTF, |
10068 | &phba->sli4_hba.sli_intf.word0)) { | 10068 | &phba->sli4_hba.sli_intf.word0)) { |
10069 | return error; | 10069 | return -ENODEV; |
10070 | } | 10070 | } |
10071 | 10071 | ||
10072 | /* There is no SLI3 failback for SLI4 devices. */ | 10072 | /* There is no SLI3 failback for SLI4 devices. */ |
@@ -10076,7 +10076,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10076 | "2894 SLI_INTF reg contents invalid " | 10076 | "2894 SLI_INTF reg contents invalid " |
10077 | "sli_intf reg 0x%x\n", | 10077 | "sli_intf reg 0x%x\n", |
10078 | phba->sli4_hba.sli_intf.word0); | 10078 | phba->sli4_hba.sli_intf.word0); |
10079 | return error; | 10079 | return -ENODEV; |
10080 | } | 10080 | } |
10081 | 10081 | ||
10082 | if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); | 10082 | if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); |
@@ -10100,7 +10100,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10100 | dev_printk(KERN_ERR, &pdev->dev, | 10100 | dev_printk(KERN_ERR, &pdev->dev, |
10101 | "ioremap failed for SLI4 PCI config " | 10101 | "ioremap failed for SLI4 PCI config " |
10102 | "registers.\n"); | 10102 | "registers.\n"); |
10103 | goto out; | 10103 | return -ENODEV; |
10104 | } | 10104 | } |
10105 | phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; | 10105 | phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p; |
10106 | /* Set up BAR0 PCI config space register memory map */ | 10106 | /* Set up BAR0 PCI config space register memory map */ |
@@ -10111,7 +10111,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10111 | if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) { | 10111 | if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) { |
10112 | dev_printk(KERN_ERR, &pdev->dev, | 10112 | dev_printk(KERN_ERR, &pdev->dev, |
10113 | "FATAL - No BAR0 mapping for SLI4, if_type 2\n"); | 10113 | "FATAL - No BAR0 mapping for SLI4, if_type 2\n"); |
10114 | goto out; | 10114 | return -ENODEV; |
10115 | } | 10115 | } |
10116 | phba->sli4_hba.conf_regs_memmap_p = | 10116 | phba->sli4_hba.conf_regs_memmap_p = |
10117 | ioremap(phba->pci_bar0_map, bar0map_len); | 10117 | ioremap(phba->pci_bar0_map, bar0map_len); |
@@ -10119,7 +10119,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10119 | dev_printk(KERN_ERR, &pdev->dev, | 10119 | dev_printk(KERN_ERR, &pdev->dev, |
10120 | "ioremap failed for SLI4 PCI config " | 10120 | "ioremap failed for SLI4 PCI config " |
10121 | "registers.\n"); | 10121 | "registers.\n"); |
10122 | goto out; | 10122 | return -ENODEV; |
10123 | } | 10123 | } |
10124 | lpfc_sli4_bar0_register_memmap(phba, if_type); | 10124 | lpfc_sli4_bar0_register_memmap(phba, if_type); |
10125 | } | 10125 | } |
@@ -10165,6 +10165,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10165 | if (!phba->sli4_hba.drbl_regs_memmap_p) { | 10165 | if (!phba->sli4_hba.drbl_regs_memmap_p) { |
10166 | dev_err(&pdev->dev, | 10166 | dev_err(&pdev->dev, |
10167 | "ioremap failed for SLI4 HBA doorbell registers.\n"); | 10167 | "ioremap failed for SLI4 HBA doorbell registers.\n"); |
10168 | error = -ENOMEM; | ||
10168 | goto out_iounmap_conf; | 10169 | goto out_iounmap_conf; |
10169 | } | 10170 | } |
10170 | phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; | 10171 | phba->pci_bar2_memmap_p = phba->sli4_hba.drbl_regs_memmap_p; |
@@ -10214,6 +10215,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) | |||
10214 | if (!phba->sli4_hba.dpp_regs_memmap_p) { | 10215 | if (!phba->sli4_hba.dpp_regs_memmap_p) { |
10215 | dev_err(&pdev->dev, | 10216 | dev_err(&pdev->dev, |
10216 | "ioremap failed for SLI4 HBA dpp registers.\n"); | 10217 | "ioremap failed for SLI4 HBA dpp registers.\n"); |
10218 | error = -ENOMEM; | ||
10217 | goto out_iounmap_ctrl; | 10219 | goto out_iounmap_ctrl; |
10218 | } | 10220 | } |
10219 | phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; | 10221 | phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; |
@@ -10244,7 +10246,7 @@ out_iounmap_ctrl: | |||
10244 | iounmap(phba->sli4_hba.ctrl_regs_memmap_p); | 10246 | iounmap(phba->sli4_hba.ctrl_regs_memmap_p); |
10245 | out_iounmap_conf: | 10247 | out_iounmap_conf: |
10246 | iounmap(phba->sli4_hba.conf_regs_memmap_p); | 10248 | iounmap(phba->sli4_hba.conf_regs_memmap_p); |
10247 | out: | 10249 | |
10248 | return error; | 10250 | return error; |
10249 | } | 10251 | } |
10250 | 10252 | ||