Skip to content

Commit

Permalink
hwrng: atmel - Use devm_clk_get()
Browse files Browse the repository at this point in the history
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Jingoo Han authored and Herbert Xu committed Mar 10, 2014
1 parent 4ea5d99 commit 0c0becd
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/char/hw_random/atmel-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ static int atmel_trng_probe(struct platform_device *pdev)
if (IS_ERR(trng->base))
return PTR_ERR(trng->base);

trng->clk = clk_get(&pdev->dev, NULL);
trng->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(trng->clk))
return PTR_ERR(trng->clk);

ret = clk_enable(trng->clk);
if (ret)
goto err_enable;
return ret;

writel(TRNG_KEY | 1, trng->base + TRNG_CR);
trng->rng.name = pdev->name;
Expand All @@ -85,9 +85,6 @@ static int atmel_trng_probe(struct platform_device *pdev)

err_register:
clk_disable(trng->clk);
err_enable:
clk_put(trng->clk);

return ret;
}

Expand All @@ -99,7 +96,6 @@ static int atmel_trng_remove(struct platform_device *pdev)

writel(TRNG_KEY, trng->base + TRNG_CR);
clk_disable(trng->clk);
clk_put(trng->clk);

return 0;
}
Expand Down

0 comments on commit 0c0becd

Please sign in to comment.