2646 fc_host_post_vendor_event(shost, fc_get_event_number(),
2647 sizeof(adapter_event),
2648 (char *) &adapter_event,
2649 SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX);
2650
2651 scsi_scan_host(shost);
2652
2653 return 0;
2654
2655out_remove_device:
2656 lpfc_free_sysfs_attr(vport);
2657 spin_lock_irq(shost->host_lock);
2658 vport->load_flag |= FC_UNLOADING;
2659 spin_unlock_irq(shost->host_lock);
2660out_free_irq:
2661 lpfc_stop_phba_timers(phba);
2662 phba->pport->work_port_events = 0;
2663
2664 if (phba->intr_type == MSIX)
2665 lpfc_disable_msix(phba);
2666 else
2667 free_irq(phba->pcidev->irq, phba);
2668
2669out_disable_msi:
2670 if (phba->intr_type == MSI)
2671 pci_disable_msi(phba->pcidev);
2672 destroy_port(vport);
2673out_kthread_stop:
2674 kthread_stop(phba->worker_thread);
2675out_free_iocbq:
2676 list_for_each_entry_safe(iocbq_entry, iocbq_next,
2677 &phba->lpfc_iocb_list, list) {
2678 kfree(iocbq_entry);
2679 phba->total_iocbq_bufs--;
2680 }
2681 lpfc_mem_free(phba);
2682out_free_hbqslimp:
2683 dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(),
2684 phba->hbqslimp.virt, phba->hbqslimp.phys);
2685out_free_slim:
2686 dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE,