Commit 62743a41 authored by Horia Geant?'s avatar Horia Geant? Committed by Herbert Xu

crypto: caam - fix RNG init descriptor ret. code checking

When successful, the descriptor that performs RNG initialization
is allowed to return a status code of 7000_0000h, since last command
in the descriptor is a JUMP HALT.
Signed-off-by: default avatarHoria Geant? <horia.geanta@freescale.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent f1096749
...@@ -175,7 +175,7 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask, ...@@ -175,7 +175,7 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
{ {
struct caam_drv_private *ctrlpriv = dev_get_drvdata(ctrldev); struct caam_drv_private *ctrlpriv = dev_get_drvdata(ctrldev);
struct caam_ctrl __iomem *ctrl; struct caam_ctrl __iomem *ctrl;
u32 *desc, status, rdsta_val; u32 *desc, status = 0, rdsta_val;
int ret = 0, sh_idx; int ret = 0, sh_idx;
ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl; ctrl = (struct caam_ctrl __iomem *)ctrlpriv->ctrl;
...@@ -207,7 +207,8 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask, ...@@ -207,7 +207,8 @@ static int instantiate_rng(struct device *ctrldev, int state_handle_mask,
* CAAM eras), then try again. * CAAM eras), then try again.
*/ */
rdsta_val = rd_reg32(&ctrl->r4tst[0].rdsta) & RDSTA_IFMASK; rdsta_val = rd_reg32(&ctrl->r4tst[0].rdsta) & RDSTA_IFMASK;
if (status || !(rdsta_val & (1 << sh_idx))) if ((status && status != JRSTA_SSRC_JUMP_HALT_CC) ||
!(rdsta_val & (1 << sh_idx)))
ret = -EAGAIN; ret = -EAGAIN;
if (ret) if (ret)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment