summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_nx.c
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2020-06-29 15:54:48 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2020-06-30 23:12:19 -0400
commit2f91a0a03c2da5140994d7b3d53469d07df9943c (patch)
tree4d10c3ce2b107780b30be865d62a1fed67df07f1 /drivers/scsi/qla2xxx/qla_nx.c
parentf1e12bee55e6eb28a53662765d5d2d96fa0247b1 (diff)
downloadlinux-stable-2f91a0a03c2da5140994d7b3d53469d07df9943c.tar.gz
linux-stable-2f91a0a03c2da5140994d7b3d53469d07df9943c.tar.bz2
linux-stable-2f91a0a03c2da5140994d7b3d53469d07df9943c.zip
scsi: qla2xxx: Make qla82xx_flash_wait_write_finish() easier to read
Return early instead of having a single return statement at the end of this function. This patch fixes the following sparse warning: qla_nx.c:1018: qla82xx_flash_wait_write_finish() error: uninitialized symbol 'val'. Link: https://lore.kernel.org/r/20200629225454.22863-4-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: Daniel Wagner <dwagner@suse.de> Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_nx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_nx.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 0baf55b7e88f..ff365b434a02 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -966,26 +966,21 @@ qla82xx_read_status_reg(struct qla_hw_data *ha, uint32_t *val)
static int
qla82xx_flash_wait_write_finish(struct qla_hw_data *ha)
{
- long timeout = 0;
- uint32_t done = 1 ;
uint32_t val;
- int ret = 0;
+ int i, ret;
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
qla82xx_wr_32(ha, QLA82XX_ROMUSB_ROM_ABYTE_CNT, 0);
- while ((done != 0) && (ret == 0)) {
+ for (i = 0; i < 50000; i++) {
ret = qla82xx_read_status_reg(ha, &val);
- done = val & 1;
- timeout++;
+ if (ret < 0 || (val & 1) == 0)
+ return ret;
udelay(10);
cond_resched();
- if (timeout >= 50000) {
- ql_log(ql_log_warn, vha, 0xb00d,
- "Timeout reached waiting for write finish.\n");
- return -1;
- }
}
- return ret;
+ ql_log(ql_log_warn, vha, 0xb00d,
+ "Timeout reached waiting for write finish.\n");
+ return -1;
}
static int