mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: fp9931: Add missing memory allocation check
@ 2026-01-18  9:26 Felix Gu
  2026-01-20 17:05 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-01-18  9:26 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: linux-kernel, Felix Gu

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

Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: Felix Gu <gu_0233@qq.com>
---
 drivers/regulator/fp9931.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
index 69b3c712e5d5..7fbcc6327cc6 100644
--- a/drivers/regulator/fp9931.c
+++ b/drivers/regulator/fp9931.c
@@ -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,
-- 
Felix Gu <gu_0233@qq.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-20 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-18  9:26 [PATCH] regulator: fp9931: Add missing memory allocation check Felix Gu
2026-01-20 17:05 ` 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®