diff options
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e6831264f67..0b12498b767 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1092,7 +1092,7 @@ iospace_error_exit: */ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) { - int ret; + int ret = -ENODEV; device_reg_t __iomem *reg; struct Scsi_Host *host; scsi_qla_host_t *ha; @@ -1103,7 +1103,7 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) fc_port_t *fcport; if (pci_enable_device(pdev)) - return -1; + goto probe_out; host = scsi_host_alloc(&qla2x00_driver_template, sizeof(scsi_qla_host_t)); @@ -1125,9 +1125,8 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) /* Configure PCI I/O space */ ret = qla2x00_iospace_config(ha); - if (ret != 0) { - goto probe_alloc_failed; - } + if (ret) + goto probe_failed; /* Sanitize the information from PCI BIOS. */ host->irq = pdev->irq; @@ -1190,22 +1189,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) qla_printk(KERN_WARNING, ha, "[ERROR] Failed to allocate memory for adapter\n"); - goto probe_alloc_failed; + ret = -ENOMEM; + goto probe_failed; } - pci_set_drvdata(pdev, ha); - host->this_id = 255; - host->cmd_per_lun = 3; - host->unique_id = ha->instance; - host->max_cmd_len = MAX_CMDSZ; - host->max_channel = ha->ports - 1; - host->max_lun = MAX_LUNS; - host->transportt = qla2xxx_transport_template; - if (scsi_add_host(host, &pdev->dev)) - goto probe_alloc_failed; - - qla2x00_alloc_sysfs_attr(ha); - if (qla2x00_initialize_adapter(ha) && !(ha->device_flags & DFLG_NO_CABLE)) { @@ -1216,11 +1203,10 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) "Adapter flags %x.\n", ha->host_no, ha->device_flags)); + ret = -ENODEV; goto probe_failed; } - qla2x00_init_host_attr(ha); - /* * Startup the kernel thread for this host adapter */ @@ -1230,17 +1216,26 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) qla_printk(KERN_WARNING, ha, "Unable to start DPC thread!\n"); + ret = -ENODEV; goto probe_failed; } wait_for_completion(&ha->dpc_inited); + host->this_id = 255; + host->cmd_per_lun = 3; + host->unique_id = ha->instance; + host->max_cmd_len = MAX_CMDSZ; + host->max_channel = ha->ports - 1; + host->max_lun = MAX_LUNS; + host->transportt = qla2xxx_transport_template; + if (IS_QLA2100(ha) || IS_QLA2200(ha)) ret = request_irq(host->irq, qla2100_intr_handler, SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); else ret = request_irq(host->irq, qla2300_intr_handler, SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); - if (ret != 0) { + if (ret) { qla_printk(KERN_WARNING, ha, "Failed to reserve interrupt %d already in use.\n", host->irq); @@ -1294,9 +1289,18 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) msleep(10); } + pci_set_drvdata(pdev, ha); ha->flags.init_done = 1; num_hosts++; + ret = scsi_add_host(host, &pdev->dev); + if (ret) + goto probe_failed; + + qla2x00_alloc_sysfs_attr(ha); + + qla2x00_init_host_attr(ha); + qla_printk(KERN_INFO, ha, "\n" " QLogic Fibre Channel HBA Driver: %s\n" " QLogic %s - %s\n" @@ -1315,9 +1319,6 @@ int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) probe_failed: fc_remove_host(ha->host); - scsi_remove_host(host); - -probe_alloc_failed: qla2x00_free_device(ha); scsi_host_put(host); @@ -1325,7 +1326,8 @@ probe_alloc_failed: probe_disable_device: pci_disable_device(pdev); - return -1; +probe_out: + return ret; } EXPORT_SYMBOL_GPL(qla2x00_probe_one); |