Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1574064pxj; Fri, 4 Jun 2021 19:22:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQUfrjslp/UNJ7OxS6sxtfEttOxNY1G5CMuohyU/v65IRqWs5SM5q0ecxiBXj3wtX3oviz X-Received: by 2002:aa7:da8c:: with SMTP id q12mr4014699eds.368.1622859761806; Fri, 04 Jun 2021 19:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622859761; cv=none; d=google.com; s=arc-20160816; b=vCAlRiMjtS2D2TJV8dxach6l7GZruk3o/X5wPek1xRR7oEBVjJIGwkALUWRPvZ8joW 8QKzecTE7Qutw72ip1OdODXiQlEobDvBy90aM43OkJo8qN0DXpI1xOODxtI+q3LHTeIk dn9mj5eCu++KfGcBWVqR04sZCnCYdmequIvw+Fw2/xrgxjFI5pUdNihz/Bu3nnnA9GDN qGLEaAGgN8IkDW8aWZl80ec10G5fApClzPiMP6WbU9l3Qqi4xFzjI7JmkkfHhJ0jmyrS yMsvenm9QV0m5OLcX6dwxJ5SyrUONmv6E1dxeXcTnHu8iZ0lZ699K8NVlGQYGd9rG5M8 kmLQ== 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=TrAdheFGwOqHWl2/6yHXBCFqdOH8qAw0qy6fsqGLoRc=; b=b2LLKCg6fw95pWLRs9ufSIAinqkdyiO/pZhvhnYjslnrONkc6Pyck4XIE4Gbm61pRg ceT2kjhpyutoMRymeqvG0cYHzLf3Q2C9ZWPflMuspMEJpSO5Epuo6Y3Qi1K2RKIvBoRW GJ/N+0yaDYIB9LsOSiyENYBeAm+p+7Fs+IxoLX1SgYcAaTweqsSMBYBgFBDYuqe8W4k2 M7ULlSjYt0l+891maaadNszrzFTc3SNFdvOc6HHZbKmoYo+Qs/f/3rqW4cnpid8kJ8yU e4e034tV7XIIV+agoJFh4ai7XFglMoWCDpd0JT0QDISSBS/Ztq8PiQe3ZOK+zEFtzYDy hVQg== 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 bm24si3650709ejb.577.2021.06.04.19.22.19; Fri, 04 Jun 2021 19:22:41 -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 S230481AbhFECWT (ORCPT + 99 others); Fri, 4 Jun 2021 22:22:19 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3433 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230169AbhFECWS (ORCPT ); Fri, 4 Jun 2021 22:22:18 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FxjvX4pFPz6tph; Sat, 5 Jun 2021 10:17:28 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 5 Jun 2021 10:20:28 +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; Sat, 5 Jun 2021 10:20:28 +0800 From: Yang Yingliang To: , CC: , , , Subject: [PATCH net-next v3] mfd: pm8008: Fix return value check in pm8008_probe() Date: Sat, 5 Jun 2021 10:24:46 +0800 Message-ID: <20210605022446.4119978-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: dggems702-chm.china.huawei.com (10.3.19.179) 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 --- v3: return PTR_ERR(chip->regmap) instead of ENODEV --- drivers/mfd/qcom-pm8008.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c index c472d7f8103c..fb8915a682ad 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -228,8 +228,8 @@ 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) - return -ENODEV; + if (IS_ERR(chip->regmap)) + return PTR_ERR(chip->regmap); i2c_set_clientdata(client, chip); -- 2.25.1