Skip to content

Commit d9b9ea5

Browse files
committed
Merge tag 'regulator-fix-v6.6-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fixes from Mark Brown: "A couple of fixes that came in during the merge window, both driver specific - one for a bug that came up in testing, one for a bug due to a misreading of the datasheet" * tag 'regulator-fix-v6.6-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: tps6594-regulator: Fix random kernel crash regulator: tps6287x: Fix n_voltages
2 parents 32904de + ca0e36e commit d9b9ea5

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

drivers/regulator/tps6287x-regulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static struct regulator_desc tps6287x_reg = {
119119
.ramp_mask = TPS6287X_CTRL1_VRAMP,
120120
.ramp_delay_table = tps6287x_ramp_table,
121121
.n_ramp_values = ARRAY_SIZE(tps6287x_ramp_table),
122-
.n_voltages = 256,
122+
.n_voltages = 256 * ARRAY_SIZE(tps6287x_voltage_ranges),
123123
.linear_ranges = tps6287x_voltage_ranges,
124124
.n_linear_ranges = ARRAY_SIZE(tps6287x_voltage_ranges),
125125
.linear_range_selectors_bitfield = tps6287x_voltage_range_sel,

drivers/regulator/tps6594-regulator.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -384,21 +384,19 @@ static int tps6594_request_reg_irqs(struct platform_device *pdev,
384384
if (irq < 0)
385385
return -EINVAL;
386386

387-
irq_data[*irq_idx + j].dev = tps->dev;
388-
irq_data[*irq_idx + j].type = irq_type;
389-
irq_data[*irq_idx + j].rdev = rdev;
387+
irq_data[*irq_idx].dev = tps->dev;
388+
irq_data[*irq_idx].type = irq_type;
389+
irq_data[*irq_idx].rdev = rdev;
390390

391391
error = devm_request_threaded_irq(tps->dev, irq, NULL,
392-
tps6594_regulator_irq_handler,
393-
IRQF_ONESHOT,
394-
irq_type->irq_name,
395-
&irq_data[*irq_idx]);
396-
(*irq_idx)++;
392+
tps6594_regulator_irq_handler, IRQF_ONESHOT,
393+
irq_type->irq_name, &irq_data[*irq_idx]);
397394
if (error) {
398395
dev_err(tps->dev, "tps6594 failed to request %s IRQ %d: %d\n",
399396
irq_type->irq_name, irq, error);
400397
return error;
401398
}
399+
(*irq_idx)++;
402400
}
403401
return 0;
404402
}
@@ -420,8 +418,8 @@ static int tps6594_regulator_probe(struct platform_device *pdev)
420418
int error, i, irq, multi, delta;
421419
int irq_idx = 0;
422420
int buck_idx = 0;
423-
int ext_reg_irq_nb = 2;
424-
421+
size_t ext_reg_irq_nb = 2;
422+
size_t reg_irq_nb;
425423
enum {
426424
MULTI_BUCK12,
427425
MULTI_BUCK123,
@@ -484,15 +482,16 @@ static int tps6594_regulator_probe(struct platform_device *pdev)
484482
}
485483
}
486484

487-
if (tps->chip_id == LP8764)
485+
if (tps->chip_id == LP8764) {
488486
/* There is only 4 buck on LP8764 */
489487
buck_configured[4] = 1;
488+
reg_irq_nb = size_mul(REGS_INT_NB, (BUCK_NB - 1));
489+
} else {
490+
reg_irq_nb = size_mul(REGS_INT_NB, (size_add(BUCK_NB, LDO_NB)));
491+
}
490492

491-
irq_data = devm_kmalloc_array(tps->dev,
492-
REGS_INT_NB * sizeof(struct tps6594_regulator_irq_data),
493-
ARRAY_SIZE(tps6594_bucks_irq_types) +
494-
ARRAY_SIZE(tps6594_ldos_irq_types),
495-
GFP_KERNEL);
493+
irq_data = devm_kmalloc_array(tps->dev, reg_irq_nb,
494+
sizeof(struct tps6594_regulator_irq_data), GFP_KERNEL);
496495
if (!irq_data)
497496
return -ENOMEM;
498497

0 commit comments

Comments
 (0)