mirror of
https://github.com/torvalds/linux.git
synced 2026-10-24 16:55:02 +02:00
regulator: tps6594-regulator: Fix n_linear_ranges for TPS65224 BUCK2-4
The TPS65224 BUCK2, BUCK3 and BUCK4 descriptors pass 4 as
n_linear_ranges, but tps65224_bucks_2_3_4_ranges[] only has two
entries, covering selectors 0x00-0x45.
The linear range helpers loop over n_linear_ranges entries, so any
lookup of a selector above 0x45 reads past the end of the array and
treats whatever follows it as two more ranges. This happens on the
normal registration path when the core checks the voltage constraints
against every selector. TPS652G1 uses the same descriptors and is
affected too.
Use ARRAY_SIZE() so the count always matches the table.
Fixes: 00c826525f ("regulator: tps6594-regulator: Add TI TPS65224 PMIC regulators")
Cc: stable@vger.kernel.org
Signed-off-by: Ridham Khurana <khurana.ridham222@gmail.com>
Link: https://patch.msgid.link/20260930105333.3522412-1-khurana.ridham222@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
72d3fcf802
commit
2f15518682
|
|
@ -241,21 +241,21 @@ static const struct regulator_desc tps65224_buck_regs[] = {
|
|||
TPS65224_MASK_BUCKS_VSET,
|
||||
TPS6594_REG_BUCKX_CTRL(1),
|
||||
TPS6594_BIT_BUCK_EN, 0, 0, tps65224_bucks_2_3_4_ranges,
|
||||
4, 0, 0, NULL, 0, 0),
|
||||
ARRAY_SIZE(tps65224_bucks_2_3_4_ranges), 0, 0, NULL, 0, 0),
|
||||
TPS6594_REGULATOR("BUCK3", "buck3", TPS6594_BUCK_3,
|
||||
REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS65224_MASK_BUCKS_VSET,
|
||||
TPS6594_REG_BUCKX_VOUT_1(2),
|
||||
TPS65224_MASK_BUCKS_VSET,
|
||||
TPS6594_REG_BUCKX_CTRL(2),
|
||||
TPS6594_BIT_BUCK_EN, 0, 0, tps65224_bucks_2_3_4_ranges,
|
||||
4, 0, 0, NULL, 0, 0),
|
||||
ARRAY_SIZE(tps65224_bucks_2_3_4_ranges), 0, 0, NULL, 0, 0),
|
||||
TPS6594_REGULATOR("BUCK4", "buck4", TPS6594_BUCK_4,
|
||||
REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS65224_MASK_BUCKS_VSET,
|
||||
TPS6594_REG_BUCKX_VOUT_1(3),
|
||||
TPS65224_MASK_BUCKS_VSET,
|
||||
TPS6594_REG_BUCKX_CTRL(3),
|
||||
TPS6594_BIT_BUCK_EN, 0, 0, tps65224_bucks_2_3_4_ranges,
|
||||
4, 0, 0, NULL, 0, 0),
|
||||
ARRAY_SIZE(tps65224_bucks_2_3_4_ranges), 0, 0, NULL, 0, 0),
|
||||
};
|
||||
|
||||
static const struct tps6594_regulator_irq_type tps6594_buck1_irq_types[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user