From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD588C4743C for ; Fri, 4 Jun 2021 17:50:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5322613FA for ; Fri, 4 Jun 2021 17:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbhFDRwo (ORCPT ); Fri, 4 Jun 2021 13:52:44 -0400 Received: from alexa-out-sd-01.qualcomm.com ([199.106.114.38]:24316 "EHLO alexa-out-sd-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229690AbhFDRwo (ORCPT ); Fri, 4 Jun 2021 13:52:44 -0400 Received: from unknown (HELO ironmsg05-sd.qualcomm.com) ([10.53.140.145]) by alexa-out-sd-01.qualcomm.com with ESMTP; 04 Jun 2021 10:50:57 -0700 X-QCInternal: smtphost Received: from gurus-linux.qualcomm.com ([10.134.64.25]) by ironmsg05-sd.qualcomm.com with ESMTP; 04 Jun 2021 10:50:57 -0700 Received: by gurus-linux.qualcomm.com (Postfix, from userid 383780) id 4C04F210ED; Fri, 4 Jun 2021 10:50:57 -0700 (PDT) Date: Fri, 4 Jun 2021 10:50:57 -0700 From: Guru Das Srinagesh To: Yang Yingliang Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lee.jones@linaro.org, agross@kernel.org, dmitry.baryshkov@linaro.org Subject: Re: [PATCH -next v2] mfd: pm8008: Fix return value check in pm8008_probe() Message-ID: <20210604175057.GA13362@codeaurora.org> References: <20210604013824.1040775-1-yangyingliang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604013824.1040775-1-yangyingliang@huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Fri, Jun 04, 2021 at 09:38:24AM +0800, Yang Yingliang wrote: > In case of error, the function devm_regmap_init_i2c() returns ERR_PTR() > and never returns NULL. The NULL test in the return value check > should be replaced with IS_ERR(). > > Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC") > Reported-by: Hulk Robot > Signed-off-by: Yang Yingliang > --- > v2: > make the change correspond to the changelog > --- > drivers/mfd/qcom-pm8008.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c > index c472d7f8103c..476171455d32 100644 > --- a/drivers/mfd/qcom-pm8008.c > +++ b/drivers/mfd/qcom-pm8008.c > @@ -228,7 +228,7 @@ static int pm8008_probe(struct i2c_client *client) > > chip->dev = &client->dev; > chip->regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg); > - if (!chip->regmap) > + if (IS_ERR(chip->regmap)) > return -ENODEV; The error received from devm_regmap_init_i2c should be returned as-is and not -ENODEV. Could you please do: if (IS_ERR(chip->regmap)) return PTR_ERR(chip->regmap); Thank you for this patch. > > i2c_set_clientdata(client, chip);