Message ID | 20230403074821.5121-1-lishuchang@hust.edu.cn (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | scsi: lpfc: fix ioremap issues in 'lpfc_sli4_pci_mem_setup' | expand |
On Mon, Apr 03, 2023 at 03:48:21PM +0800, lishuchang@hust.edu.cn wrote: > @@ -12069,9 +12069,11 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) > return 0; > > out_iounmap_all: > - iounmap(phba->sli4_hba.drbl_regs_memmap_p); > + if (!phba->sli4_hba.drbl_regs_memmap_p) > + iounmap(phba->sli4_hba.drbl_regs_memmap_p); The test is reversed still. If you make a mistake, you should write a static checker warning so that you never make the same mistake again. ;) See attached. > out_iounmap_ctrl: > - iounmap(phba->sli4_hba.ctrl_regs_memmap_p); > + if (!phba->sli4_hba.ctrl_regs_memmap_p) Also reversed. > + iounmap(phba->sli4_hba.ctrl_regs_memmap_p); > out_iounmap_conf: > iounmap(phba->sli4_hba.conf_regs_memmap_p); regards, dan carpenter
On 2023/4/3 17:16, Dan Carpenter wrote: > On Mon, Apr 03, 2023 at 03:48:21PM +0800, lishuchang@hust.edu.cn wrote: >> @@ -12069,9 +12069,11 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) >> return 0; >> >> out_iounmap_all: >> - iounmap(phba->sli4_hba.drbl_regs_memmap_p); >> + if (!phba->sli4_hba.drbl_regs_memmap_p) >> + iounmap(phba->sli4_hba.drbl_regs_memmap_p); > The test is reversed still. Thanks for your review, Dan. Sorry for my internal careless review. Shuchang is creating a v2 patch to fix all the mentioned issues. Really sorry about this stupid mistake. > > If you make a mistake, you should write a static checker warning so that > you never make the same mistake again. ;) See attached. > > >> out_iounmap_ctrl: >> - iounmap(phba->sli4_hba.ctrl_regs_memmap_p); >> + if (!phba->sli4_hba.ctrl_regs_memmap_p) > Also reversed. > >> + iounmap(phba->sli4_hba.ctrl_regs_memmap_p); >> out_iounmap_conf: >> iounmap(phba->sli4_hba.conf_regs_memmap_p); > regards, > dan carpenter > >
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 4f7485958c49..bd5e734487e3 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -12026,7 +12026,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) goto out_iounmap_all; } else { error = -ENOMEM; - goto out_iounmap_all; + goto out_iounmap_ctrl; } } @@ -12044,7 +12044,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) dev_err(&pdev->dev, "ioremap failed for SLI4 HBA dpp registers.\n"); error = -ENOMEM; - goto out_iounmap_ctrl; + goto out_iounmap_all; } phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; } @@ -12069,9 +12069,11 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) return 0; out_iounmap_all: - iounmap(phba->sli4_hba.drbl_regs_memmap_p); + if (!phba->sli4_hba.drbl_regs_memmap_p) + iounmap(phba->sli4_hba.drbl_regs_memmap_p); out_iounmap_ctrl: - iounmap(phba->sli4_hba.ctrl_regs_memmap_p); + if (!phba->sli4_hba.ctrl_regs_memmap_p) + iounmap(phba->sli4_hba.ctrl_regs_memmap_p); out_iounmap_conf: iounmap(phba->sli4_hba.conf_regs_memmap_p);