diff mbox

[6/6] mfd: smsc-ece1099: Return directly after a function failure in smsc_i2c_probe()

Message ID 7de4f21e-30a2-fab6-204d-890619ccbbe6@users.sourceforge.net (mailing list archive)
State New, archived
Headers show

Commit Message

SF Markus Elfring June 26, 2016, 1:54 p.m. UTC
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 26 Jun 2016 14:30:46 +0200

This issue was detected by using the Coccinelle software.

Return directly if a call of the function "devm_regmap_init_i2c"
or "regmap_write" failed.

Delete the jump label "err" then.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/smsc-ece1099.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Lee Jones June 28, 2016, 3:08 p.m. UTC | #1
On Sun, 26 Jun 2016, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 26 Jun 2016 14:30:46 +0200
> 
> This issue was detected by using the Coccinelle software.
> 
> Return directly if a call of the function "devm_regmap_init_i2c"
> or "regmap_write" failed.
> 
> Delete the jump label "err" then.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mfd/smsc-ece1099.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
> index 2aaf89f..cd18c09 100644
> --- a/drivers/mfd/smsc-ece1099.c
> +++ b/drivers/mfd/smsc-ece1099.c
> @@ -46,10 +46,8 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
>  	}
>  
>  	smsc->regmap = devm_regmap_init_i2c(i2c, &smsc_regmap_config);
> -	if (IS_ERR(smsc->regmap)) {
> -		ret = PTR_ERR(smsc->regmap);
> -		goto err;
> -	}
> +	if (IS_ERR(smsc->regmap))
> +		return PTR_ERR(smsc->regmap);
>  
>  	i2c_set_clientdata(i2c, smsc);
>  	smsc->dev = &i2c->dev;
> @@ -68,7 +66,7 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
>  
>  	ret = regmap_write(smsc->regmap, SMSC_CLK_CTRL, smsc->clk);
>  	if (ret)
> -		goto err;
> +		return ret;
>  
>  #ifdef CONFIG_OF
>  	if (i2c->dev.of_node)
> @@ -76,7 +74,6 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
>  					   NULL, NULL, &i2c->dev);
>  #endif
>  
> -err:
>  	return ret;
>  }
>
diff mbox

Patch

diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
index 2aaf89f..cd18c09 100644
--- a/drivers/mfd/smsc-ece1099.c
+++ b/drivers/mfd/smsc-ece1099.c
@@ -46,10 +46,8 @@  static int smsc_i2c_probe(struct i2c_client *i2c,
 	}
 
 	smsc->regmap = devm_regmap_init_i2c(i2c, &smsc_regmap_config);
-	if (IS_ERR(smsc->regmap)) {
-		ret = PTR_ERR(smsc->regmap);
-		goto err;
-	}
+	if (IS_ERR(smsc->regmap))
+		return PTR_ERR(smsc->regmap);
 
 	i2c_set_clientdata(i2c, smsc);
 	smsc->dev = &i2c->dev;
@@ -68,7 +66,7 @@  static int smsc_i2c_probe(struct i2c_client *i2c,
 
 	ret = regmap_write(smsc->regmap, SMSC_CLK_CTRL, smsc->clk);
 	if (ret)
-		goto err;
+		return ret;
 
 #ifdef CONFIG_OF
 	if (i2c->dev.of_node)
@@ -76,7 +74,6 @@  static int smsc_i2c_probe(struct i2c_client *i2c,
 					   NULL, NULL, &i2c->dev);
 #endif
 
-err:
 	return ret;
 }