Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1169512AbdDXMGk (ORCPT ); Mon, 24 Apr 2017 08:06:40 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37542 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1169460AbdDXMGe (ORCPT ); Mon, 24 Apr 2017 08:06:34 -0400 Date: Mon, 24 Apr 2017 13:06:31 +0100 From: Lee Jones To: Pan Bian Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: Re: [PATCH 1/1] mfd: intel_soc_pmic_core: fix unchecked return value Message-ID: <20170424120631.hzq5vahet6ck356g@dell> References: <1492950564-8888-1-git-send-email-bianpan201602@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1492950564-8888-1-git-send-email-bianpan201602@163.com> User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1207 Lines: 35 On Sun, 23 Apr 2017, Pan Bian wrote: > From: Pan Bian > > 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 > --- > 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