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

crypto: inside-secure - improve clock initialization

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>

authored by

Gregory CLEMENT and committed by
Herbert Xu
5b376896 f962eb46

+6 -5
+6 -5
drivers/crypto/inside-secure/safexcel.c
··· 882 882 } 883 883 884 884 priv->clk = devm_clk_get(&pdev->dev, NULL); 885 - if (!IS_ERR(priv->clk)) { 885 + ret = PTR_ERR_OR_ZERO(priv->clk); 886 + /* The clock isn't mandatory */ 887 + if (ret != -ENOENT) { 888 + if (ret) 889 + return ret; 890 + 886 891 ret = clk_prepare_enable(priv->clk); 887 892 if (ret) { 888 893 dev_err(dev, "unable to enable clk (%d)\n", ret); 889 894 return ret; 890 895 } 891 - } else { 892 - /* The clock isn't mandatory */ 893 - if (PTR_ERR(priv->clk) == -EPROBE_DEFER) 894 - return -EPROBE_DEFER; 895 896 } 896 897 897 898 ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));