regulator: mp886x: fix two issues reported by sashiko
cover regulator: mp886x: fix two issues reported by sashiko
Fix two issues reported by sashiko.
https://sashiko.dev/#/patchset/[email protected]?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(-)
Signature · 1 line
2.53.0
PATCH 1/2 regulator: mp886x: check get_voltage_sel() return value
The get_voltage_sel() can fail, resulting in negative error codes stored in unsigned integers and corrupted state logic.
--- drivers/regulator/mp886x.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/regulator/mp886x.c +7 -1
@@ -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 ; }
Signature · 1 line
2.53.0
PATCH 2/2 regulator: mp886x: fix pontential division by zero
In reply to Jisheng ZhangIf the "mps,fb-voltage-divider" 2nd var is 0, there will be division by zero bug.
--- drivers/regulator/mp886x.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/regulator/mp886x.c +3 -0
@@ -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);
Signature · 1 line
2.53.0
Mark Brown
maintainerQuoted 10 lines · Jisheng Zhang
regulator: mp886x: fix two issues reported by sashiko
Fix two issues reported by sashiko.
https://sashiko.dev/#/patchset/[email protected]?part=1Jisheng Zhang (2):
regulator: mp886x: checkget_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