Commit 986130bf authored by Arvind Yadav's avatar Arvind Yadav Committed by Herbert Xu
Browse files

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: default avatarArvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent cce2ea8d
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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);