Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1629015 > unrolled thread

[PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value

Started byPan Bian <bianpan201602@163.com>
First post2017-04-23 14:40 +0200
Last post2017-04-24 14:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value Pan Bian <bianpan201602@163.com> - 2017-04-23 14:40 +0200
    Re: [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value Lee Jones <lee.jones@linaro.org> - 2017-04-24 14:10 +0200

#1629015 — [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value

FromPan Bian <bianpan201602@163.com>
Date2017-04-23 14:40 +0200
Subject[PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value
Message-ID<tzoY2-8vp-19@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1629460

FromLee Jones <lee.jones@linaro.org>
Date2017-04-24 14:10 +0200
Message-ID<tzKYx-6Qa-7@gated-at.bofh.it>
In reply to#1629015
On Sun, 23 Apr 2017, Pan Bian wrote:

> 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(+)

Applied, thanks.

> 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

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web