Skip to content

Commit

Permalink
crypto: inside-secure - improve clock initialization
Browse files Browse the repository at this point in the history
The clock is optional, but if it is present we should managed it. If
there is an error while trying getting it, we should exit and report this
error.

So instead of returning an error only in the -EPROBE case, turn it in an
other way and ignore the clock only if it is not present (-ENOENT case).

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Gregory CLEMENT authored and Herbert Xu committed Mar 23, 2018
1 parent f962eb4 commit 5b37689
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/crypto/inside-secure/safexcel.c
Original file line number Diff line number Diff line change
@@ -882,16 +882,17 @@ static int safexcel_probe(struct platform_device *pdev)
}

priv->clk = devm_clk_get(&pdev->dev, NULL);
if (!IS_ERR(priv->clk)) {
ret = PTR_ERR_OR_ZERO(priv->clk);
/* The clock isn't mandatory */
if (ret != -ENOENT) {
if (ret)
return ret;

ret = clk_prepare_enable(priv->clk);
if (ret) {
dev_err(dev, "unable to enable clk (%d)\n", ret);
return ret;
}
} else {
/* The clock isn't mandatory */
if (PTR_ERR(priv->clk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
}

ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));

0 comments on commit 5b37689

Please sign in to comment.