Skip to content

Commit

Permalink
scsi: pm80xx: fix logic to break out of loop when register value is 2…
Browse files Browse the repository at this point in the history
… or 3

The condition (reg_val != 2) || (reg_val != 3) will always be true because
reg_val cannot be equal to two different values at the same time. Fix this
by replacing the || operator with && so that the loop will loop if reg_val
is not a 2 and not a 3 as was originally intended.

Fixes: 50dc2f221455 ("scsi: pm80xx: Modified the logic to collect fatal dump")
Link: https://lore.kernel.org/r/20191120135031.270708-1-colin.king@canonical.com
Addresses-Coverity: ("Constant expression result")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Colin Ian King authored and Martin K. Petersen committed Nov 27, 2019
1 parent 82ea3e0 commit 0e7c353
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/pm8001/pm80xx_hwi.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev,
do {
reg_val = pm8001_mr32(fatal_table_address,
MPI_FATAL_EDUMP_TABLE_STATUS);
} while (((reg_val != 2) || (reg_val != 3)) &&
} while (((reg_val != 2) && (reg_val != 3)) &&
time_before(jiffies, start));

if (reg_val < 2) {
Expand Down

0 comments on commit 0e7c353

Please sign in to comment.