Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1306313pxj; Fri, 4 Jun 2021 10:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVjDIdkuNlIS4+LvelIp7yJydlukswygw9ZzDNyO75ksB5uy0ujjaBWjpkURrMt3H0Kx1/ X-Received: by 2002:aa7:d74b:: with SMTP id a11mr5950646eds.95.1622829144219; Fri, 04 Jun 2021 10:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622829144; cv=none; d=google.com; s=arc-20160816; b=f3kFHeCf5525uzo+Dm8nEI4xHUTMXp/b8y7fAgb6hGG3tK9ElwUGxVhodWz21+1S7a xWQ6Z7n+kj4FTf+RHBWjiI9rNM99leR7PIN0btDKn8X4AeycD258Mi5V4yomhz+fm0D7 m1sGfwQWZbDj2NTXD9fGYDNyoAs9zcR9t1hY9opD5autUtmgxv+cLQ/dO2tk0uiCD+5V 1KPLDM57YKzaspSrg4N7sCsIvhaJbpVtzaDMF+e9Gn3tCf7NHZ9A6UPvKhEGdT3NwpCS QGZoEWntaRW+Hf7s+TunYOlsMwx9OnOwy2kg5weRB28TE6yi10ubXe5zXY4zQPu+mUWD qYtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=o3H1elwoG+40arNhnjF8vPZBg/7kbEvzoT9yU0BVRjE=; b=t5Mtlz2NyTE7xCzXtqjNmO00qui/2/n8uS2slj8n6hKmogNbEMGS99QfixhUCim021 TL78KTaKOxwuNZFyjiuIZw83APVx0I1oonA7qEzaRYpT0kyzqGFJ+Y+sdZOZ6JTrklZD 8Wx5w9vb2wsJcVMxuJkxpmC1z/3xx13om521cuG6EKqg6kvPDea4BHdzr68vh5Yxqg95 PPwU9APFtaAkeSYPqwICvs7wrkscYTYejRXmPQC8BxaloGJoLE9C1jSUaFw9n30toa5J VujZMS0aKGj9drDFY+Ls9NZc1DbCI20X29T0IEcNjWhhcnnQylrZ1JFpujapUXw3VlNo 9HUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si5010673ejc.745.2021.06.04.10.52.00; Fri, 04 Jun 2021 10:52:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbhFDRwo (ORCPT + 99 others); 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-kernel@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);