Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a65fbf6 authored by Kiran Padwal's avatar Kiran Padwal Committed by Lee Jones
Browse files

mfd: intel_soc_pmic: Add missing error check for devm_kzalloc



This patch add a missing check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

Signed-off-by: default avatarKiran Padwal <kiran.padwal@smartplayin.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent bb400d21
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -64,6 +64,9 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
	config = (struct intel_soc_pmic_config *)id->driver_data;

	pmic = devm_kzalloc(dev, sizeof(*pmic), GFP_KERNEL);
	if (!pmic)
		return -ENOMEM;

	dev_set_drvdata(dev, pmic);

	pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);