2013-07-21 17:41:51

by Fabio Estevam

[permalink] [raw]
Subject: [PATCH] hw_random: mxc-rnga: Check the return value from clk_prepare_enable()

From: Fabio Estevam <[email protected]>

clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

Signed-off-by: Fabio Estevam <[email protected]>
---
drivers/char/hw_random/mxc-rnga.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c
index 19a12ac..6a86b6f 100644
--- a/drivers/char/hw_random/mxc-rnga.c
+++ b/drivers/char/hw_random/mxc-rnga.c
@@ -164,7 +164,9 @@ static int __init mxc_rnga_probe(struct platform_device *pdev)
goto out;
}

- clk_prepare_enable(mxc_rng->clk);
+ err = clk_prepare_enable(mxc_rng->clk);
+ if (err)
+ goto out;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
mxc_rng->mem = devm_ioremap_resource(&pdev->dev, res);
--
1.8.1.2


2013-08-01 01:47:36

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] hw_random: mxc-rnga: Check the return value from clk_prepare_enable()

On Sun, Jul 21, 2013 at 02:41:38PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <[email protected]>
>
> clk_prepare_enable() may fail, so let's check its return value and propagate it
> in the case of error.
>
> Signed-off-by: Fabio Estevam <[email protected]>

Patch applied. Thanks!
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt