summaryrefslogtreecommitdiff
path: root/drivers/char/hw_random/omap3-rom-rng.c
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-05-15 11:22:03 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-05-23 07:52:03 +0300
commit986130bf3701e9875a820e06ed5c6ae0a851900b (patch)
treef1e6bdf287fd3893152f7cb15d7c8fa4708e887d /drivers/char/hw_random/omap3-rom-rng.c
parentcce2ea8d90fec72ed954830e73f5d4995cc79193 (diff)
downloadlinux-986130bf3701e9875a820e06ed5c6ae0a851900b.tar.xz
hwrng: omap3-rom - Handle return value of clk_prepare_enable
Here, Clock enable can failed. So adding an error check for clk_prepare_enable. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random/omap3-rom-rng.c')
-rw-r--r--drivers/char/hw_random/omap3-rom-rng.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/char/hw_random/omap3-rom-rng.c b/drivers/char/hw_random/omap3-rom-rng.c
index 37a58d78aab3..38b719017186 100644
--- a/drivers/char/hw_random/omap3-rom-rng.c
+++ b/drivers/char/hw_random/omap3-rom-rng.c
@@ -53,7 +53,10 @@ static int omap3_rom_rng_get_random(void *buf, unsigned int count)
cancel_delayed_work_sync(&idle_work);
if (rng_idle) {
- clk_prepare_enable(rng_clk);
+ r = clk_prepare_enable(rng_clk);
+ if (r)
+ return r;
+
r = omap3_rom_rng_call(0, 0, RNG_GEN_PRNG_HW_INIT);
if (r != 0) {
clk_disable_unprepare(rng_clk);
@@ -88,6 +91,8 @@ static struct hwrng omap3_rom_rng_ops = {
static int omap3_rom_rng_probe(struct platform_device *pdev)
{
+ int ret = 0;
+
pr_info("initializing\n");
omap3_rom_rng_call = pdev->dev.platform_data;
@@ -104,7 +109,9 @@ static int omap3_rom_rng_probe(struct platform_device *pdev)
}
/* Leave the RNG in reset state. */
- clk_prepare_enable(rng_clk);
+ ret = clk_prepare_enable(rng_clk);
+ if (ret)
+ return ret;
omap3_rom_rng_idle(0);
return hwrng_register(&omap3_rom_rng_ops);