linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH] regulator: tps65219: Fix matching interrupts for their regulators
@ 2023-05-07 14:46 Krzysztof Kozlowski
  2023-05-08  8:53 ` Markus Schneider-Pargmann
  2023-05-09  6:39 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2023-05-07 14:46 UTC (permalink / raw)
  To: Tony Lindgren, Liam Girdwood, Mark Brown, Jerome Neanne,
	linux-omap, linux-kernel
  Cc: Krzysztof Kozlowski, stable, khilman, msp, j-keerthy

The driver's probe() first registers regulators in a loop and then in a
second loop passes them as irq data to the interrupt handlers.  However
the function to get the regulator for given name
tps65219_get_rdev_by_name() was a no-op due to argument passed by value,
not pointer, thus the second loop assigned always same value - from
previous loop.  The interrupts, when fired, where executed with wrong
data.  Compiler also noticed it:

  drivers/regulator/tps65219-regulator.c: In function ‘tps65219_get_rdev_by_name’:
  drivers/regulator/tps65219-regulator.c:292:60: error: parameter ‘dev’ set but not used [-Werror=unused-but-set-parameter]

Fixes: c12ac5fc3e0a ("regulator: drivers: Add TI TPS65219 PMIC regulators support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Not tested.
Sent two months ago and no comments, so resending.

Cc: Jerome Neanne <jneanne@baylibre.com>
Cc: khilman@baylibre.com
Cc: msp@baylibre.com
Cc: j-keerthy@ti.com
---
 drivers/regulator/tps65219-regulator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
index b1719ee990ab..8971b507a79a 100644
--- a/drivers/regulator/tps65219-regulator.c
+++ b/drivers/regulator/tps65219-regulator.c
@@ -289,13 +289,13 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
 
 static int tps65219_get_rdev_by_name(const char *regulator_name,
 				     struct regulator_dev *rdevtbl[7],
-				     struct regulator_dev *dev)
+				     struct regulator_dev **dev)
 {
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
 		if (strcmp(regulator_name, regulators[i].name) == 0) {
-			dev = rdevtbl[i];
+			*dev = rdevtbl[i];
 			return 0;
 		}
 	}
@@ -348,7 +348,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
 		irq_data[i].dev = tps->dev;
 		irq_data[i].type = irq_type;
 
-		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
+		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, &rdev);
 		if (IS_ERR(rdev)) {
 			dev_err(tps->dev, "Failed to get rdev for %s\n",
 				irq_type->regulator_name);
-- 
2.34.1


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

* Re: [RESEND PATCH] regulator: tps65219: Fix matching interrupts for their regulators
  2023-05-07 14:46 [RESEND PATCH] regulator: tps65219: Fix matching interrupts for their regulators Krzysztof Kozlowski
@ 2023-05-08  8:53 ` Markus Schneider-Pargmann
  2023-05-09  6:39 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Schneider-Pargmann @ 2023-05-08  8:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Tony Lindgren, Liam Girdwood, Mark Brown, Jerome Neanne,
	linux-omap, linux-kernel, stable, khilman, j-keerthy

Hi,

On Sun, May 07, 2023 at 04:46:56PM +0200, Krzysztof Kozlowski wrote:
> The driver's probe() first registers regulators in a loop and then in a
> second loop passes them as irq data to the interrupt handlers.  However
> the function to get the regulator for given name
> tps65219_get_rdev_by_name() was a no-op due to argument passed by value,
> not pointer, thus the second loop assigned always same value - from
> previous loop.  The interrupts, when fired, where executed with wrong
> data.  Compiler also noticed it:
> 
>   drivers/regulator/tps65219-regulator.c: In function ‘tps65219_get_rdev_by_name’:
>   drivers/regulator/tps65219-regulator.c:292:60: error: parameter ‘dev’ set but not used [-Werror=unused-but-set-parameter]
> 
> Fixes: c12ac5fc3e0a ("regulator: drivers: Add TI TPS65219 PMIC regulators support")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Markus Schneider-Pargmann <msp@baylibre.com>

Best,
Markus

> 
> ---
> 
> Not tested.
> Sent two months ago and no comments, so resending.
> 
> Cc: Jerome Neanne <jneanne@baylibre.com>
> Cc: khilman@baylibre.com
> Cc: msp@baylibre.com
> Cc: j-keerthy@ti.com
> ---
>  drivers/regulator/tps65219-regulator.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/tps65219-regulator.c b/drivers/regulator/tps65219-regulator.c
> index b1719ee990ab..8971b507a79a 100644
> --- a/drivers/regulator/tps65219-regulator.c
> +++ b/drivers/regulator/tps65219-regulator.c
> @@ -289,13 +289,13 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
>  
>  static int tps65219_get_rdev_by_name(const char *regulator_name,
>  				     struct regulator_dev *rdevtbl[7],
> -				     struct regulator_dev *dev)
> +				     struct regulator_dev **dev)
>  {
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
>  		if (strcmp(regulator_name, regulators[i].name) == 0) {
> -			dev = rdevtbl[i];
> +			*dev = rdevtbl[i];
>  			return 0;
>  		}
>  	}
> @@ -348,7 +348,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
>  		irq_data[i].dev = tps->dev;
>  		irq_data[i].type = irq_type;
>  
> -		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
> +		tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, &rdev);
>  		if (IS_ERR(rdev)) {
>  			dev_err(tps->dev, "Failed to get rdev for %s\n",
>  				irq_type->regulator_name);
> -- 
> 2.34.1
> 

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

* Re: [RESEND PATCH] regulator: tps65219: Fix matching interrupts for their regulators
  2023-05-07 14:46 [RESEND PATCH] regulator: tps65219: Fix matching interrupts for their regulators Krzysztof Kozlowski
  2023-05-08  8:53 ` Markus Schneider-Pargmann
@ 2023-05-09  6:39 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-05-09  6:39 UTC (permalink / raw)
  To: Tony Lindgren, Liam Girdwood, Jerome Neanne, linux-omap,
	linux-kernel, Krzysztof Kozlowski
  Cc: stable, khilman, msp, j-keerthy

On Sun, 07 May 2023 16:46:56 +0200, Krzysztof Kozlowski wrote:
> The driver's probe() first registers regulators in a loop and then in a
> second loop passes them as irq data to the interrupt handlers.  However
> the function to get the regulator for given name
> tps65219_get_rdev_by_name() was a no-op due to argument passed by value,
> not pointer, thus the second loop assigned always same value - from
> previous loop.  The interrupts, when fired, where executed with wrong
> data.  Compiler also noticed it:
> 
> [...]

Applied to

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

Thanks!

[1/1] regulator: tps65219: Fix matching interrupts for their regulators
      commit: f050e56de80591fee55bedbdf5b6b998c740cd0c

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:[~2023-05-09  6:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-07 14:46 [RESEND PATCH] regulator: tps65219: Fix matching interrupts for their regulators Krzysztof Kozlowski
2023-05-08  8:53 ` Markus Schneider-Pargmann
2023-05-09  6:39 ` 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).