Skip to content

Commit 3a487ff

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
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: 56de835 ("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>
1 parent a656183 commit 3a487ff

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10049,7 +10049,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
1004910049
{
1005010050
struct pci_dev *pdev = phba->pcidev;
1005110051
unsigned long bar0map_len, bar1map_len, bar2map_len;
10052-
int error = -ENODEV;
10052+
int error;
1005310053
uint32_t if_type;
1005410054

1005510055
if (!pdev)
@@ -10066,7 +10066,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
1006610066
*/
1006710067
if (pci_read_config_dword(pdev, LPFC_SLI_INTF,
1006810068
&phba->sli4_hba.sli_intf.word0)) {
10069-
return error;
10069+
return -ENODEV;
1007010070
}
1007110071

1007210072
/* There is no SLI3 failback for SLI4 devices. */
@@ -10076,7 +10076,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
1007610076
"2894 SLI_INTF reg contents invalid "
1007710077
"sli_intf reg 0x%x\n",
1007810078
phba->sli4_hba.sli_intf.word0);
10079-
return error;
10079+
return -ENODEV;
1008010080
}
1008110081

1008210082
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)
1010010100
dev_printk(KERN_ERR, &pdev->dev,
1010110101
"ioremap failed for SLI4 PCI config "
1010210102
"registers.\n");
10103-
goto out;
10103+
return -ENODEV;
1010410104
}
1010510105
phba->pci_bar0_memmap_p = phba->sli4_hba.conf_regs_memmap_p;
1010610106
/* Set up BAR0 PCI config space register memory map */
@@ -10111,15 +10111,15 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
1011110111
if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) {
1011210112
dev_printk(KERN_ERR, &pdev->dev,
1011310113
"FATAL - No BAR0 mapping for SLI4, if_type 2\n");
10114-
goto out;
10114+
return -ENODEV;
1011510115
}
1011610116
phba->sli4_hba.conf_regs_memmap_p =
1011710117
ioremap(phba->pci_bar0_map, bar0map_len);
1011810118
if (!phba->sli4_hba.conf_regs_memmap_p) {
1011910119
dev_printk(KERN_ERR, &pdev->dev,
1012010120
"ioremap failed for SLI4 PCI config "
1012110121
"registers.\n");
10122-
goto out;
10122+
return -ENODEV;
1012310123
}
1012410124
lpfc_sli4_bar0_register_memmap(phba, if_type);
1012510125
}
@@ -10165,6 +10165,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
1016510165
if (!phba->sli4_hba.drbl_regs_memmap_p) {
1016610166
dev_err(&pdev->dev,
1016710167
"ioremap failed for SLI4 HBA doorbell registers.\n");
10168+
error = -ENOMEM;
1016810169
goto out_iounmap_conf;
1016910170
}
1017010171
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)
1021410215
if (!phba->sli4_hba.dpp_regs_memmap_p) {
1021510216
dev_err(&pdev->dev,
1021610217
"ioremap failed for SLI4 HBA dpp registers.\n");
10218+
error = -ENOMEM;
1021710219
goto out_iounmap_ctrl;
1021810220
}
1021910221
phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p;
@@ -10244,7 +10246,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
1024410246
iounmap(phba->sli4_hba.ctrl_regs_memmap_p);
1024510247
out_iounmap_conf:
1024610248
iounmap(phba->sli4_hba.conf_regs_memmap_p);
10247-
out:
10249+
1024810250
return error;
1024910251
}
1025010252

0 commit comments

Comments
 (0)