* [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko
@ 2026-09-09 14:39 Jisheng Zhang
2026-09-09 14:39 ` [PATCH 1/2] regulator: mp886x: check get_voltage_sel() return value Jisheng Zhang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jisheng Zhang @ 2026-09-09 14:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: linux-kernel
Fix two issues reported by sashiko.
https://sashiko.dev/#/patchset/20260901043123.5401-1-jszhang@kernel.org?part=1
Jisheng Zhang (2):
regulator: mp886x: check get_voltage_sel() return value
regulator: mp886x: fix pontential division by zero
drivers/regulator/mp886x.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] regulator: mp886x: check get_voltage_sel() return value
2026-09-09 14:39 [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Jisheng Zhang
@ 2026-09-09 14:39 ` Jisheng Zhang
2026-09-09 14:39 ` [PATCH 2/2] regulator: mp886x: fix pontential division by zero Jisheng Zhang
2026-09-22 13:49 ` [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Jisheng Zhang @ 2026-09-09 14:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: linux-kernel
The get_voltage_sel() can fail, resulting in negative error codes
stored in unsigned integers and corrupted state logic.
Fixes: 97be82880b61 ("regulator: add support for MP8869 regulator")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260901043123.5401-1-jszhang@kernel.org?part=1
---
drivers/regulator/mp886x.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/mp886x.c b/drivers/regulator/mp886x.c
index e0b62bc02a1e..bc25cba33c8b 100644
--- a/drivers/regulator/mp886x.c
+++ b/drivers/regulator/mp886x.c
@@ -256,6 +256,7 @@ static int mp886x_regulator_register(struct mp886x_device_info *di,
{
struct regulator_desc *rdesc = &di->desc;
struct regulator_dev *rdev;
+ int sel;
rdesc->name = "mp886x-reg";
rdesc->supply_name = "vin";
@@ -277,7 +278,12 @@ static int mp886x_regulator_register(struct mp886x_device_info *di,
rdev = devm_regulator_register(di->dev, &di->desc, config);
if (IS_ERR(rdev))
return PTR_ERR(rdev);
- di->sel = rdesc->ops->get_voltage_sel(rdev);
+
+ sel = rdesc->ops->get_voltage_sel(rdev);
+ if (sel < 0)
+ return sel;
+ di->sel = sel;
+
return 0;
}
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] regulator: mp886x: fix pontential division by zero
2026-09-09 14:39 [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Jisheng Zhang
2026-09-09 14:39 ` [PATCH 1/2] regulator: mp886x: check get_voltage_sel() return value Jisheng Zhang
@ 2026-09-09 14:39 ` Jisheng Zhang
2026-09-22 13:49 ` [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Jisheng Zhang @ 2026-09-09 14:39 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: linux-kernel
If the "mps,fb-voltage-divider" 2nd var is 0, there will be division
by zero bug.
Fixes: 97be82880b61 ("regulator: add support for MP8869 regulator")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260901043123.5401-1-jszhang@kernel.org?part=1
---
drivers/regulator/mp886x.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/regulator/mp886x.c b/drivers/regulator/mp886x.c
index bc25cba33c8b..dda34bf0a74d 100644
--- a/drivers/regulator/mp886x.c
+++ b/drivers/regulator/mp886x.c
@@ -317,6 +317,9 @@ static int mp886x_i2c_probe(struct i2c_client *client)
if (ret)
return ret;
+ if (di->r[1] == 0)
+ return -EINVAL;
+
di->en_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(di->en_gpio))
return PTR_ERR(di->en_gpio);
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko
2026-09-09 14:39 [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Jisheng Zhang
2026-09-09 14:39 ` [PATCH 1/2] regulator: mp886x: check get_voltage_sel() return value Jisheng Zhang
2026-09-09 14:39 ` [PATCH 2/2] regulator: mp886x: fix pontential division by zero Jisheng Zhang
@ 2026-09-22 13:49 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-09-22 13:49 UTC (permalink / raw)
To: Liam Girdwood, Jisheng Zhang; +Cc: linux-kernel
On Wed, 09 Sep 2026 22:39:55 +0800, Jisheng Zhang wrote:
> regulator: mp886x: fix two issues reported by sashiko
>
> Fix two issues reported by sashiko.
> https://sashiko.dev/#/patchset/20260901043123.5401-1-jszhang@kernel.org?part=1
>
> Jisheng Zhang (2):
> regulator: mp886x: check get_voltage_sel() return value
> regulator: mp886x: fix pontential division by zero
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.4
Thanks!
[1/2] regulator: mp886x: check get_voltage_sel() return value
https://git.kernel.org/broonie/regulator/c/87121c42fadc
[2/2] regulator: mp886x: fix pontential division by zero
https://git.kernel.org/broonie/regulator/c/d16ef5debccc
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] 4+ messages in thread
end of thread, other threads:[~2026-09-23 8:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-09 14:39 [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Jisheng Zhang
2026-09-09 14:39 ` [PATCH 1/2] regulator: mp886x: check get_voltage_sel() return value Jisheng Zhang
2026-09-09 14:39 ` [PATCH 2/2] regulator: mp886x: fix pontential division by zero Jisheng Zhang
2026-09-22 13:49 ` [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®