diff options
author | Martin Kaiser <martin@kaiser.cx> | 2023-07-10 22:27:31 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-07-22 13:59:37 +1200 |
commit | 6257490b95252b0c22e4b518570d438cedc78a0d (patch) | |
tree | 031c439ff0dea7267d95c25d052a2a269ba97b76 /drivers/char/hw_random/ingenic-trng.c | |
parent | e4ab6e72e84d4cfd6f8e5f477204f3053a79108f (diff) | |
download | linux-6257490b95252b0c22e4b518570d438cedc78a0d.tar.gz linux-6257490b95252b0c22e4b518570d438cedc78a0d.tar.bz2 linux-6257490b95252b0c22e4b518570d438cedc78a0d.zip |
hwrng: ingenic - use dev_err_probe in error paths
Use dev_err_probe in error paths to make the code a bit shorter.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random/ingenic-trng.c')
-rw-r--r-- | drivers/char/hw_random/ingenic-trng.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 906fa78de47e..cc88a941c929 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -84,16 +84,14 @@ static int ingenic_trng_probe(struct platform_device *pdev) return -ENOMEM; trng->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(trng->base)) { - pr_err("%s: Failed to map DTRNG registers\n", __func__); - return PTR_ERR(trng->base); - } + if (IS_ERR(trng->base)) + return dev_err_probe(&pdev->dev, PTR_ERR(trng->base), + "%s: Failed to map DTRNG registers\n", __func__); clk = devm_clk_get_enabled(&pdev->dev, NULL); - if (IS_ERR(clk)) { - pr_crit("%s: Cannot get and enable DTRNG clock\n", __func__); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "%s: Cannot get and enable DTRNG clock\n", __func__); trng->rng.name = pdev->name; trng->rng.init = ingenic_trng_init; @@ -101,10 +99,8 @@ static int ingenic_trng_probe(struct platform_device *pdev) trng->rng.read = ingenic_trng_read; ret = hwrng_register(&trng->rng); - if (ret) { - dev_err(&pdev->dev, "Failed to register hwrng\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n"); platform_set_drvdata(pdev, trng); |