From: Pan Bian Date: Sun, 23 Apr 2017 12:29:24 +0000 (+0800) Subject: mfd: intel_soc_pmic_core: Fix unchecked return value X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=db43b8d04d7a9fa0ac18db6de2c4741dcefbcc0b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mfd: intel_soc_pmic_core: Fix unchecked return value unction devm_regmap_init_i2c() returns an ERR_PTR on errors, and its return value should be checked before it is dereferenced. However, in function intel_soc_pmic_i2c_probe(), the return value of function devm_regmap_init_i2c() is used without validation. This patch fixes it. Signed-off-by: Pan Bian Signed-off-by: Lee Jones --- diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c index 3b5583586662..13737be6df35 100644 --- a/drivers/mfd/intel_soc_pmic_core.c +++ b/drivers/mfd/intel_soc_pmic_core.c @@ -66,6 +66,9 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, dev_set_drvdata(dev, pmic); pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config); + if (IS_ERR(pmic->regmap)) + return PTR_ERR(pmic->regmap); + pmic->irq = i2c->irq; ret = regmap_add_irq_chip(pmic->regmap, pmic->irq,