Skip to content

Commit d744ae7

Browse files
martin-kaiserherbertx
authored andcommitted
hwrng: imx-rngc - fix the timeout for init and self check
Fix the timeout that is used for the initialisation and for the self test. wait_for_completion_timeout expects a timeout in jiffies, but RNGC_TIMEOUT is in milliseconds. Call msecs_to_jiffies to do the conversion. Cc: stable@vger.kernel.org Fixes: 1d54494 ("hwrng: mx-rngc - add a driver for Freescale RNGC") Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 63ba4d6 commit d744ae7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/char/hw_random/imx-rngc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static int imx_rngc_self_test(struct imx_rngc *rngc)
110110
cmd = readl(rngc->base + RNGC_COMMAND);
111111
writel(cmd | RNGC_CMD_SELF_TEST, rngc->base + RNGC_COMMAND);
112112

113-
ret = wait_for_completion_timeout(&rngc->rng_op_done, RNGC_TIMEOUT);
113+
ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT));
114114
imx_rngc_irq_mask_clear(rngc);
115115
if (!ret)
116116
return -ETIMEDOUT;
@@ -182,9 +182,7 @@ static int imx_rngc_init(struct hwrng *rng)
182182
cmd = readl(rngc->base + RNGC_COMMAND);
183183
writel(cmd | RNGC_CMD_SEED, rngc->base + RNGC_COMMAND);
184184

185-
ret = wait_for_completion_timeout(&rngc->rng_op_done,
186-
RNGC_TIMEOUT);
187-
185+
ret = wait_for_completion_timeout(&rngc->rng_op_done, msecs_to_jiffies(RNGC_TIMEOUT));
188186
if (!ret) {
189187
ret = -ETIMEDOUT;
190188
goto err;

0 commit comments

Comments
 (0)