lkml.org 
[lkml]   [2017]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value
Date
From: Pan Bian <bianpan2016@163.com>

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 <bianpan2016@163.com>
---
drivers/mfd/intel_soc_pmic_core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index 12d6ebb4..0498854 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -83,6 +83,8 @@ 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);

/*
* On some boards the PMIC interrupt may come from a GPIO line. Try to
--
1.9.1

\
 
 \ /
  Last update: 2017-04-23 14:30    [W:0.027 / U:1.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site