linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: bd9576: Fix return from bd957x_probe()
@ 2021-03-12  7:42 Dan Carpenter
  2021-03-15  5:27 ` Matti Vaittinen
  2021-03-15 16:57 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-03-12  7:42 UTC (permalink / raw)
  To: Matti Vaittinen
  Cc: Liam Girdwood, Mark Brown, linux-power, linux-kernel, kernel-janitors

The probe() function returns an uninitialized variable in the success
path.  There is no need for the "err" variable at all, just delete it.

Fixes: b014e9fae7e7 ("regulator: Support ROHM BD9576MUF and BD9573MUF")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/regulator/bd9576-regulator.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/regulator/bd9576-regulator.c b/drivers/regulator/bd9576-regulator.c
index a8b5832a5a1b..204a2da054f5 100644
--- a/drivers/regulator/bd9576-regulator.c
+++ b/drivers/regulator/bd9576-regulator.c
@@ -206,7 +206,7 @@ static int bd957x_probe(struct platform_device *pdev)
 {
 	struct regmap *regmap;
 	struct regulator_config config = { 0 };
-	int i, err;
+	int i;
 	bool vout_mode, ddr_sel;
 	const struct bd957x_regulator_data *reg_data = &bd9576_regulators[0];
 	unsigned int num_reg_data = ARRAY_SIZE(bd9576_regulators);
@@ -279,8 +279,7 @@ static int bd957x_probe(struct platform_device *pdev)
 		break;
 	default:
 		dev_err(&pdev->dev, "Unsupported chip type\n");
-		err = -EINVAL;
-		goto err;
+		return -EINVAL;
 	}
 
 	config.dev = pdev->dev.parent;
@@ -300,8 +299,7 @@ static int bd957x_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev,
 				"failed to register %s regulator\n",
 				desc->name);
-			err = PTR_ERR(rdev);
-			goto err;
+			return PTR_ERR(rdev);
 		}
 		/*
 		 * Clear the VOUT1 GPIO setting - rest of the regulators do not
@@ -310,8 +308,7 @@ static int bd957x_probe(struct platform_device *pdev)
 		config.ena_gpiod = NULL;
 	}
 
-err:
-	return err;
+	return 0;
 }
 
 static const struct platform_device_id bd957x_pmic_id[] = {
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: bd9576: Fix return from bd957x_probe()
  2021-03-12  7:42 [PATCH] regulator: bd9576: Fix return from bd957x_probe() Dan Carpenter
@ 2021-03-15  5:27 ` Matti Vaittinen
  2021-03-15 16:57 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Matti Vaittinen @ 2021-03-15  5:27 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Mark Brown, linux-power, linux-kernel, kernel-janitors


On Fri, 2021-03-12 at 10:42 +0300, Dan Carpenter wrote:
> The probe() function returns an uninitialized variable in the success
> path.  There is no need for the "err" variable at all, just delete
> it.
> 
> Fixes: b014e9fae7e7 ("regulator: Support ROHM BD9576MUF and
> BD9573MUF")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for killing the bug Dan! Very much appreciated.

By the way, this is going to conflict with the regulator notification
extension RFC series. I will rebase the RFC when this gets in tree.

Reviewed-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

> ---
>  drivers/regulator/bd9576-regulator.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/regulator/bd9576-regulator.c
> b/drivers/regulator/bd9576-regulator.c
> index a8b5832a5a1b..204a2da054f5 100644
> --- a/drivers/regulator/bd9576-regulator.c
> +++ b/drivers/regulator/bd9576-regulator.c
> @@ -206,7 +206,7 @@ static int bd957x_probe(struct platform_device
> *pdev)
>  {
>  	struct regmap *regmap;
>  	struct regulator_config config = { 0 };
> -	int i, err;
> +	int i;
>  	bool vout_mode, ddr_sel;
>  	const struct bd957x_regulator_data *reg_data =
> &bd9576_regulators[0];
>  	unsigned int num_reg_data = ARRAY_SIZE(bd9576_regulators);
> @@ -279,8 +279,7 @@ static int bd957x_probe(struct platform_device
> *pdev)
>  		break;
>  	default:
>  		dev_err(&pdev->dev, "Unsupported chip type\n");
> -		err = -EINVAL;
> -		goto err;
> +		return -EINVAL;
>  	}
>  
>  	config.dev = pdev->dev.parent;
> @@ -300,8 +299,7 @@ static int bd957x_probe(struct platform_device
> *pdev)
>  			dev_err(&pdev->dev,
>  				"failed to register %s regulator\n",
>  				desc->name);
> -			err = PTR_ERR(rdev);
> -			goto err;
> +			return PTR_ERR(rdev);
>  		}
>  		/*
>  		 * Clear the VOUT1 GPIO setting - rest of the
> regulators do not
> @@ -310,8 +308,7 @@ static int bd957x_probe(struct platform_device
> *pdev)
>  		config.ena_gpiod = NULL;
>  	}
>  
> -err:
> -	return err;
> +	return 0;
>  }
>  
>  static const struct platform_device_id bd957x_pmic_id[] = {


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: bd9576: Fix return from bd957x_probe()
  2021-03-12  7:42 [PATCH] regulator: bd9576: Fix return from bd957x_probe() Dan Carpenter
  2021-03-15  5:27 ` Matti Vaittinen
@ 2021-03-15 16:57 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2021-03-15 16:57 UTC (permalink / raw)
  To: Dan Carpenter, Matti Vaittinen
  Cc: Mark Brown, Liam Girdwood, kernel-janitors, linux-power, linux-kernel

On Fri, 12 Mar 2021 10:42:52 +0300, Dan Carpenter wrote:
> The probe() function returns an uninitialized variable in the success
> path.  There is no need for the "err" variable at all, just delete it.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: bd9576: Fix return from bd957x_probe()
      commit: 320fcd6bbd2b500923db518902c2c640242d2b50

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-15 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  7:42 [PATCH] regulator: bd9576: Fix return from bd957x_probe() Dan Carpenter
2021-03-15  5:27 ` Matti Vaittinen
2021-03-15 16:57 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).