hwrng: mxc-rnga - Remove unneeded goto label
Fabio Estevam
reviewerPATCH 1/4 hwrng: mxc-rnga - Remove unneeded goto label
From: Fabio Estevam <[email protected]>
We can simplify the code by returning the error code immediately instead of jumping to a goto label.
--- drivers/char/hw_random/mxc-rnga.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/char/hw_random/mxc-rnga.c +2 -5
@@ -160,13 +160,12 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) mxc_rng->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (mxc_rng->clk)) {dev_err (&pdev->dev,"Could not get rng_clk!\n" ); - err =PTR_ERR (mxc_rng->clk); - goto out; +return PTR_ERR (mxc_rng->clk); } err =clk_prepare_enable (mxc_rng->clk);if (err) - goto out; +return err; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); mxc_rng->mem =devm_ioremap_resource (&pdev->dev, res);
@@ -187,8 +186,6 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) err_ioremap:clk_disable_unprepare (mxc_rng->clk); - -out:return err; }
Signature · 1 line
1.9.1
Fabio Estevam
reviewerPATCH 2/4 hwrng: mxc-rnga - Remove uneeded initialization
From: Fabio Estevam <[email protected]>
There is no need to pre-initialize variable 'err' as this initial value will be overwritten later on.
--- drivers/char/hw_random/mxc-rnga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/mxc-rnga.c +1 -1
@@ -141,7 +141,7 @@ static void mxc_rnga_cleanup(struct hwrng *rng)static int __init mxc_rnga_probe (struct platform_device *pdev) { -int err = -ENODEV ; +int err;struct resource *res;struct mxc_rng *mxc_rng;
Signature · 1 line
1.9.1
Fabio Estevam
reviewerPATCH 3/4 hwrng: mxc-rnga - Remove unnecessary dev_info message
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
There is no need to print a message simply saying that a kernel driver has been registered, so remove it.
--- drivers/char/hw_random/mxc-rnga.c | 2 -- 1 file changed, 2 deletions(-)
drivers/char/hw_random/mxc-rnga.c +0 -2
@@ -180,8 +180,6 @@ static int __init mxc_rnga_probe(struct platform_device *pdev) goto err_ioremap; } -dev_info (&pdev->dev,"MXC RNGA Registered.\n" ); -return 0 ; err_ioremap:
Signature · 1 line
1.9.1
Fabio Estevam
reviewerPATCH 4/4 hwrng: mxc-rnga - Use the preferred format for kzalloc
In reply to Fabio EstevamFrom: Fabio Estevam <[email protected]>
According to Documentation/CodingStyle:
"The preferred form for passing a size of a struct is the following:
p = kmalloc(sizeof(*p), ...);"
,so do as suggested.
--- drivers/char/hw_random/mxc-rnga.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/hw_random/mxc-rnga.c +1 -2
@@ -145,8 +145,7 @@ static int __init mxc_rnga_probe(struct platform_device *pdev)struct resource *res;struct mxc_rng *mxc_rng; - mxc_rng =devm_kzalloc (&pdev->dev,sizeof (struct mxc_rng ), -GFP_KERNEL ); + mxc_rng =devm_kzalloc (&pdev->dev,sizeof (*mxc_rng),GFP_KERNEL );if (!mxc_rng)return -ENOMEM ;
Signature · 1 line
1.9.1
Herbert Xu
maintainerQuoted 6 lines · Fabio Estevam
From: Fabio Estevam <[email protected]>
We can simplify the code by returning the error code immediately instead of jumping to a goto label.
Signed-off-by Fabio Estevam <[email protected]>
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt