Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp725094pxj; Thu, 3 Jun 2021 18:37:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz10ul0j+4VCwi6vaKkYnOJxbYmD41ZZGPmX9Nzt6cx5l8MkzdGrPxe7XChgPJr9DWMyWd9 X-Received: by 2002:a05:6402:22f3:: with SMTP id dn19mr2159569edb.240.1622770665692; Thu, 03 Jun 2021 18:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622770665; cv=none; d=google.com; s=arc-20160816; b=b1PEYoGiDCnw83DlJh1AymJUuYsdp3/AjfCTJn23U9w4eI+M8jO8karTJwwkmVcfvO LEjoo7I43Dr3QbQzR8McqM+v2DZysdc4R7zW26E4KXvgn2GyKfeCXgJdzyAUGYnjzp40 2WWLF9PPbSYnWhwIpMP2XZiRkpm5w4UYe96Hyu82To3cEguaSS0+zmY41Qbk6oXbItbV ycGy471QktwCDQCjb9usMv5ZveTlcliig89B3OtDADYJcGUDjc7MQxHJd18Q0gUr1zXa 5Uz8VvCXdQcjupcb0kupv1FaQNp8w4DD6zkOfskHls7PogBuyJ1hVa9h9PUOsDAuhEz7 +qwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=I/IWEjnKPJrWCMcVflBzDG26sh0nDqSDctroXYj9cpc=; b=LCFrjlKAWJoHBiPIIKcurlJwao8frm10IqSDoYTduDlAd69SPblEtbstpzYkIcMfwd DwnXVN3yUhLBAJYiZSxc6xetfhMK7fuzuV83Dl/WXGYXE3Wqp+LUz1mtcq3ly6B8RMXz LWC9eutvP1BTlePnAz13A1sZrYHcNpkSszlbawklnv6yHWHy8iSJjsscfNut7owVHOvI DpN7nwlQZfgaFAewcV9+5BRbzO2ZUM4Vx8wpPsyxFC7Iu0eY7vPUDmBUlyuPRa7KDDvE 6pLfQkhEKDDubHZQbcp5Y+baDKxLsH9ypsSE6aPtd+Z/Z7AyNhGKU5vT2YjbBv6ILBBy DkCw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si3248786ejf.291.2021.06.03.18.37.20; Thu, 03 Jun 2021 18:37:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230098AbhFDBfx (ORCPT + 99 others); Thu, 3 Jun 2021 21:35:53 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:4297 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbhFDBfw (ORCPT ); Thu, 3 Jun 2021 21:35:52 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fx4tR4Pztz1BFTV; Fri, 4 Jun 2021 09:29:19 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 4 Jun 2021 09:34:04 +0800 Received: from huawei.com (10.175.103.91) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 4 Jun 2021 09:34:03 +0800 From: Yang Yingliang To: , CC: , , , Subject: [PATCH -next v2] mfd: pm8008: Fix return value check in pm8008_probe() Date: Fri, 4 Jun 2021 09:38:24 +0800 Message-ID: <20210604013824.1040775-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; i2c_set_clientdata(client, chip); -- 2.25.1