Commit 6257490b authored by Martin Kaiser's avatar Martin Kaiser Committed by Herbert Xu

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: default avatarMartin Kaiser <martin@kaiser.cx>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e4ab6e72
...@@ -84,16 +84,14 @@ static int ingenic_trng_probe(struct platform_device *pdev) ...@@ -84,16 +84,14 @@ static int ingenic_trng_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
trng->base = devm_platform_ioremap_resource(pdev, 0); trng->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(trng->base)) { if (IS_ERR(trng->base))
pr_err("%s: Failed to map DTRNG registers\n", __func__); return dev_err_probe(&pdev->dev, PTR_ERR(trng->base),
return PTR_ERR(trng->base); "%s: Failed to map DTRNG registers\n", __func__);
}
clk = devm_clk_get_enabled(&pdev->dev, NULL); clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk))
pr_crit("%s: Cannot get and enable DTRNG clock\n", __func__); return dev_err_probe(&pdev->dev, PTR_ERR(clk),
return PTR_ERR(clk); "%s: Cannot get and enable DTRNG clock\n", __func__);
}
trng->rng.name = pdev->name; trng->rng.name = pdev->name;
trng->rng.init = ingenic_trng_init; trng->rng.init = ingenic_trng_init;
...@@ -101,10 +99,8 @@ static int ingenic_trng_probe(struct platform_device *pdev) ...@@ -101,10 +99,8 @@ static int ingenic_trng_probe(struct platform_device *pdev)
trng->rng.read = ingenic_trng_read; trng->rng.read = ingenic_trng_read;
ret = hwrng_register(&trng->rng); ret = hwrng_register(&trng->rng);
if (ret) { if (ret)
dev_err(&pdev->dev, "Failed to register hwrng\n"); return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n");
return ret;
}
platform_set_drvdata(pdev, trng); platform_set_drvdata(pdev, trng);
......
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