Skip to contentSkip to conversation

regulator: fp9931: Add missing memory allocation check

PATCH In review Felix Gu 2 participants 2 messages Jan 18 – Jan 20 Voltage and current regulator framework

lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 regulator: fp9931: Add missing memory allocation check

Add a check for devm_kzalloc failure in fp9931_probe to prevent a null pointer dereference.

Fixes 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
---
 drivers/regulator/fp9931.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/regulator/fp9931.c +3 -0
index 69b3c712e5d5..7fbcc6327cc6 100644
@@ -439,6 +439,9 @@ static int fp9931_probe(struct i2c_client *client)
 	int i;
 
 	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
 	data->regmap = devm_regmap_init_i2c(client, &regmap_config);
 	if (IS_ERR(data->regmap))
 		return dev_err_probe(&client->dev, PTR_ERR(data->regmap),

---
base-commit: 46fe65a2c28ecf5df1a7475aba1f08ccf4c0ac1b
change-id: 20260118-fp9931-60bbc1e8a351

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer
#1 lore raw
Quoted 4 lines · Felix Gu

Add a check for devm_kzalloc failure in fp9931_probe to prevent a null pointer dereference.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: fp9931: Add missing memory allocation check

      commit: e3b76494d675e49fa032ec47f58487875a1de70a

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