From: Jisheng Zhang <jszhang@kernel.org>
To: Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] regulator: mp886x: fix pontential division by zero
Date: Wed, 9 Sep 2026 22:39:57 +0800 [thread overview]
Message-ID: <20260909143957.9284-3-jszhang@kernel.org> (raw)
In-Reply-To: <20260909143957.9284-1-jszhang@kernel.org>
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
next prev parent reply other threads:[~2026-09-09 14:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-09-22 13:49 ` [PATCH 0/2] regulator: mp886x: fix two issues reported by sashiko Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260909143957.9284-3-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.