Commit defbcf11 authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.1.5 : Fix cleanup code in the lpfc_pci_probe_one() error code path

Fix cleanup code in the lpfc_pci_probe_one() error code path.

This changes the original patch by:
  - hardsetting the return value from lpfc_pci_probe_one() to
    -ENODEV (negative value) if we fail attach
  - removes the checks from lpfc_pci_remove_one() validating the
    host and phba pointers as it's no longer needed.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 82d9a2a2
...@@ -1618,7 +1618,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -1618,7 +1618,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
error = lpfc_alloc_sysfs_attr(phba); error = lpfc_alloc_sysfs_attr(phba);
if (error) if (error)
goto out_kthread_stop; goto out_remove_host;
error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ, error = request_irq(phba->pcidev->irq, lpfc_intr_handler, SA_SHIRQ,
LPFC_DRIVER_NAME, phba); LPFC_DRIVER_NAME, phba);
...@@ -1635,8 +1635,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) ...@@ -1635,8 +1635,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET; phba->HCregaddr = phba->ctrl_regs_memmap_p + HC_REG_OFFSET;
error = lpfc_sli_hba_setup(phba); error = lpfc_sli_hba_setup(phba);
if (error) if (error) {
error = -ENODEV;
goto out_free_irq; goto out_free_irq;
}
if (phba->cfg_poll & DISABLE_FCP_RING_INT) { if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
spin_lock_irq(phba->host->host_lock); spin_lock_irq(phba->host->host_lock);
...@@ -1691,6 +1693,9 @@ out_free_irq: ...@@ -1691,6 +1693,9 @@ out_free_irq:
free_irq(phba->pcidev->irq, phba); free_irq(phba->pcidev->irq, phba);
out_free_sysfs_attr: out_free_sysfs_attr:
lpfc_free_sysfs_attr(phba); lpfc_free_sysfs_attr(phba);
out_remove_host:
fc_remove_host(phba->host);
scsi_remove_host(phba->host);
out_kthread_stop: out_kthread_stop:
kthread_stop(phba->worker_thread); kthread_stop(phba->worker_thread);
out_free_iocbq: out_free_iocbq:
...@@ -1712,12 +1717,14 @@ out_iounmap_slim: ...@@ -1712,12 +1717,14 @@ out_iounmap_slim:
out_idr_remove: out_idr_remove:
idr_remove(&lpfc_hba_index, phba->brd_no); idr_remove(&lpfc_hba_index, phba->brd_no);
out_put_host: out_put_host:
phba->host = NULL;
scsi_host_put(host); scsi_host_put(host);
out_release_regions: out_release_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
out_disable_device: out_disable_device:
pci_disable_device(pdev); pci_disable_device(pdev);
out: out:
pci_set_drvdata(pdev, NULL);
return error; return error;
} }
......
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