Unverified Commit e3b76494 authored by Felix Gu's avatar Felix Gu Committed by Mark Brown
Browse files

regulator: fp9931: Add missing memory allocation check



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

Fixes: 12d821bd ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: default avatarFelix Gu <gu_0233@qq.com>
Link: https://patch.msgid.link/tencent_5FCF2108621C51007E5526A7C60A5CC1F306@qq.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 24d479d2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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),