Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp307479pxj; Thu, 3 Jun 2021 07:13:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzV6R7co0F0r8V+1VZ48AyPkEALc+2B+vU2hsPjiwL14s1GwaLC9cV8yYu1MTfcFmEd9Pa0 X-Received: by 2002:a05:6402:48f:: with SMTP id k15mr29262edv.262.1622729594666; Thu, 03 Jun 2021 07:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622729594; cv=none; d=google.com; s=arc-20160816; b=eMyrrY89IsI185VuDMzLnpAyj+VMQq3u4LPcg/u/CCkcmhrJKRxb+8MngtlB8FoKmq 1lrvxQVoaYoGvWgA/N5JlJJCI47lq2zANq2k/KyZEsC99dEK5FpEnV8GerJPGkewMTWf jldBShNi36mK5G226hO5VqMIZgQebmMw8iEjSt8FL0aA+G2kJKC8Yo3Lv6NbtpKWgwgq 8fQRBRyhZLiYuIzCWECSITn4XWZ+d+5SCFIo1cSZ6dz+fdTA4drCA0qeOABjTKyf4fG4 kJpviIDBU6pqdC0vaOKx1HMKVtAZ3oHgggry6wNhHX/P3dIW/5GmUG/2sjbAMuDh6l68 lBcw== 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=OG0h5SLDbrqe6eHlwzw7uKcKk2Ch0dWSQRuvQoDWpzA=; b=xHl2CGrqHaExf/5r8PzkSiuDV7XuFiMy5SUuPlHbRDsDaqmxjy2bma+s8/DigZr9YZ i3qr7wc9nA0heDey3pGrxvW4i7blg7bdATg/3ZHBYv3DtDTj5Cv1uXifTZyDOlSqw1js mItH+2VMSz3zyKqY6ULGT91ZtwZxWlyaJkuQzQxwNNwh4+9BLslp55Wbf9TsYE88CKck sCcUsocUmY10TyfXL2bpCmz0kHdMTPdbCYY7fxCOXzZK51qGO2xWEsAsDH03WWQwyp1h sUZVkPRwp+hl+x3OT1OuB5co6q0A06+QKXYCIwoOA7Fbmq+N488KOz9do86uvOFPpnTE sqAw== 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 lh4si2361601ejb.152.2021.06.03.07.12.51; Thu, 03 Jun 2021 07:13:14 -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 S230386AbhFCOL1 (ORCPT + 99 others); Thu, 3 Jun 2021 10:11:27 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:3410 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbhFCOL0 (ORCPT ); Thu, 3 Jun 2021 10:11:26 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Fwnjr13HBz63cj; Thu, 3 Jun 2021 22:05:52 +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; Thu, 3 Jun 2021 22:09:37 +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; Thu, 3 Jun 2021 22:09:37 +0800 From: Yang Yingliang To: , CC: , , Subject: [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe() Date: Thu, 3 Jun 2021 22:13:57 +0800 Message-ID: <20210603141357.572347-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 --- 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..dfefa60d693b 100644 --- a/drivers/mfd/qcom-pm8008.c +++ b/drivers/mfd/qcom-pm8008.c @@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client) struct pm8008_data *chip; chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); - if (!chip) + if (IS_ERR(chip)) return -ENOMEM; chip->dev = &client->dev; -- 2.25.1