Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine")
Signed-off-by: Everest K.C. <everestkc@everestkc.com.np>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Everest K.C and committed by
Herbert Xu
53d91ca7 7a42b7b9

+2 -2
+2 -2
drivers/crypto/cavium/cpt/cptpf_main.c
··· 44 44 dev_err(dev, "Cores still busy %llx", coremask); 45 45 grp = cpt_read_csr64(cpt->reg_base, 46 46 CPTX_PF_EXEC_BUSY(0)); 47 - if (timeout--) 47 + if (!timeout--) 48 48 break; 49 49 50 50 udelay(CSR_DELAY); ··· 394 394 dev_err(dev, "Cores still busy"); 395 395 grp = cpt_read_csr64(cpt->reg_base, 396 396 CPTX_PF_EXEC_BUSY(0)); 397 - if (timeout--) 397 + if (!timeout--) 398 398 break; 399 399 400 400 udelay(CSR_DELAY);