Skip to content

Commit 53d91ca

Browse files
everestkcherbertx
authored andcommitted
crypto: cavium - Fix the if condition to exit loop after timeout
The while loop breaks in the first run because of incorrect if condition. It also causes the statements after the if to appear dead. Fix this by changing the condition from if(timeout--) to if(!timeout--). This bug was reported by Coverity Scan. Report: CID 1600859: (#1 of 1): Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this statement: udelay(30UL); Fixes: 9e2c7d9 ("crypto: cavium - Add Support for Octeon-tx CPT Engine") Signed-off-by: Everest K.C. <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 7a42b7b commit 53d91ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/crypto/cavium/cpt/cptpf_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void cpt_disable_cores(struct cpt_device *cpt, u64 coremask,
4444
dev_err(dev, "Cores still busy %llx", coremask);
4545
grp = cpt_read_csr64(cpt->reg_base,
4646
CPTX_PF_EXEC_BUSY(0));
47-
if (timeout--)
47+
if (!timeout--)
4848
break;
4949

5050
udelay(CSR_DELAY);
@@ -394,7 +394,7 @@ static void cpt_disable_all_cores(struct cpt_device *cpt)
394394
dev_err(dev, "Cores still busy");
395395
grp = cpt_read_csr64(cpt->reg_base,
396396
CPTX_PF_EXEC_BUSY(0));
397-
if (timeout--)
397+
if (!timeout--)
398398
break;
399399

400400
udelay(CSR_DELAY);

0 commit comments

Comments
 (0)