Commit f85a299f authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: qla2xxx: Make qla2x00_restart_isp() easier to read

Instead of using complicated control flow to only have one return statement
at the end of qla2x00_restart_isp(), return an error status as soon as it
is known that this function will fail.

Link: https://lore.kernel.org/r/20200629225454.22863-9-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Quinn Tran <qutran@marvell.com>
Cc: Himanshu Madhani <himanshu.madhani@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: default avatarDaniel Wagner <dwagner@suse.de>
Reviewed-by: default avatarHimanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 57fec9f2
...@@ -6996,36 +6996,41 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) ...@@ -6996,36 +6996,41 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)
static int static int
qla2x00_restart_isp(scsi_qla_host_t *vha) qla2x00_restart_isp(scsi_qla_host_t *vha)
{ {
int status = 0; int status;
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
/* If firmware needs to be loaded */ /* If firmware needs to be loaded */
if (qla2x00_isp_firmware(vha)) { if (qla2x00_isp_firmware(vha)) {
vha->flags.online = 0; vha->flags.online = 0;
status = ha->isp_ops->chip_diag(vha); status = ha->isp_ops->chip_diag(vha);
if (!status) if (status)
status = qla2x00_setup_chip(vha); return status;
status = qla2x00_setup_chip(vha);
if (status)
return status;
} }
if (!status && !(status = qla2x00_init_rings(vha))) { status = qla2x00_init_rings(vha);
clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags); if (status)
ha->flags.chip_reset_done = 1; return status;
/* Initialize the queues in use */ clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags);
qla25xx_init_queues(ha); ha->flags.chip_reset_done = 1;
status = qla2x00_fw_ready(vha); /* Initialize the queues in use */
if (!status) { qla25xx_init_queues(ha);
/* Issue a marker after FW becomes ready. */
qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL);
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
}
status = qla2x00_fw_ready(vha);
if (status) {
/* if no cable then assume it's good */ /* if no cable then assume it's good */
if ((vha->device_flags & DFLG_NO_CABLE)) return vha->device_flags & DFLG_NO_CABLE ? 0 : status;
status = 0;
} }
return (status);
/* Issue a marker after FW becomes ready. */
qla2x00_marker(vha, ha->base_qpair, 0, 0, MK_SYNC_ALL);
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
return 0;
} }
static int static int
......
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