Commit 11f92a13 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Herbert Xu

hwrng: xgene - Simplify using dev_err_probe()

dev_err_probe simplifies the idiom:

	if (ret != -EPROBE_DEFER)
		dev_err(...)
	return ret;

, emits the error code in a human readable way and even yields a useful
entry in /sys/kernel/debug/devices_deferred in the EPROBE_DEFER case.

So simplify and at the same time improve the driver by using
dev_err_probe().
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 4c9edf17
......@@ -337,10 +337,8 @@ static int xgene_rng_probe(struct platform_device *pdev)
rc = devm_request_irq(&pdev->dev, ctx->irq, xgene_rng_irq_handler, 0,
dev_name(&pdev->dev), ctx);
if (rc) {
dev_err(&pdev->dev, "Could not request RNG alarm IRQ\n");
return rc;
}
if (rc)
return dev_err_probe(&pdev->dev, rc, "Could not request RNG alarm IRQ\n");
/* Enable IP clock */
ctx->clk = devm_clk_get(&pdev->dev, NULL);
......@@ -348,30 +346,25 @@ static int xgene_rng_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "Couldn't get the clock for RNG\n");
} else {
rc = clk_prepare_enable(ctx->clk);
if (rc) {
dev_warn(&pdev->dev,
"clock prepare enable failed for RNG");
return rc;
}
if (rc)
return dev_err_probe(&pdev->dev, rc,
"clock prepare enable failed for RNG");
}
xgene_rng_func.priv = (unsigned long) ctx;
rc = devm_hwrng_register(&pdev->dev, &xgene_rng_func);
if (rc) {
dev_err(&pdev->dev, "RNG registering failed error %d\n", rc);
if (!IS_ERR(ctx->clk))
clk_disable_unprepare(ctx->clk);
return rc;
return dev_err_probe(&pdev->dev, rc, "RNG registering failed\n");
}
rc = device_init_wakeup(&pdev->dev, 1);
if (rc) {
dev_err(&pdev->dev, "RNG device_init_wakeup failed error %d\n",
rc);
if (!IS_ERR(ctx->clk))
clk_disable_unprepare(ctx->clk);
return rc;
return dev_err_probe(&pdev->dev, rc, "RNG device_init_wakeup failed\n");
}
return 0;
......
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