Skip to content

Commit f050e56

Browse files
krzkbroonie
authored andcommitted
regulator: tps65219: Fix matching interrupts for their regulators
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: c12ac5f ("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 Link: https://lore.kernel.org/r/20230507144656.192800-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org
1 parent 964e186 commit f050e56

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/regulator/tps65219-regulator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,13 +289,13 @@ static irqreturn_t tps65219_regulator_irq_handler(int irq, void *data)
289289

290290
static int tps65219_get_rdev_by_name(const char *regulator_name,
291291
struct regulator_dev *rdevtbl[7],
292-
struct regulator_dev *dev)
292+
struct regulator_dev **dev)
293293
{
294294
int i;
295295

296296
for (i = 0; i < ARRAY_SIZE(regulators); i++) {
297297
if (strcmp(regulator_name, regulators[i].name) == 0) {
298-
dev = rdevtbl[i];
298+
*dev = rdevtbl[i];
299299
return 0;
300300
}
301301
}
@@ -348,7 +348,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
348348
irq_data[i].dev = tps->dev;
349349
irq_data[i].type = irq_type;
350350

351-
tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
351+
tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, &rdev);
352352
if (IS_ERR(rdev)) {
353353
dev_err(tps->dev, "Failed to get rdev for %s\n",
354354
irq_type->regulator_name);

0 commit comments

Comments
 (0)