linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value
@ 2017-04-23 12:29 Pan Bian
  2017-04-24 12:06 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2017-04-23 12:29 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Pan Bian

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value
  2017-04-23 12:29 [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value Pan Bian
@ 2017-04-24 12:06 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2017-04-24 12:06 UTC (permalink / raw)
  To: Pan Bian; +Cc: linux-kernel, Pan Bian

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-24 12:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-23 12:29 [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value Pan Bian
2017-04-24 12:06 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).