From nobody Wed Apr 15 23:24:09 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 833E4C4332F for ; Tue, 22 Nov 2022 08:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbiKVIYt (ORCPT ); Tue, 22 Nov 2022 03:24:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232132AbiKVIYq (ORCPT ); Tue, 22 Nov 2022 03:24:46 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40A17286DF for ; Tue, 22 Nov 2022 00:24:46 -0800 (PST) Received: from kwepemi500023.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NGcjn1lqRz15Mqw; Tue, 22 Nov 2022 16:24:13 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500023.china.huawei.com (7.221.188.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 16:24:41 +0800 From: Peng Wu To: , , CC: , , Peng Wu Subject: [PATCH -next] iregulator: of: fix a NULL vs IS_ERR() check in of_regulator_bulk_get_all() Date: Tue, 22 Nov 2022 08:22:42 +0000 Message-ID: <20221122082242.82937-1-wupeng58@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500023.china.huawei.com (7.221.188.76) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The regulator_get() function never returns NULL. It returns error pointers. Fixes: 27b9ecc7a9ba ("regulator: Add of_regulator_bulk_get_all") Signed-off-by: Peng Wu --- drivers/regulator/of_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regula= tor.c index 584c92f1a317..f7529f1bf8b2 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -767,7 +767,7 @@ int of_regulator_bulk_get_all(struct device *dev, struc= t device_node *np, memcpy(name, prop->name, i); name[i] =3D '\0'; tmp =3D regulator_get(dev, name); - if (!tmp) { + if (IS_ERR(tmp)) { ret =3D -EINVAL; goto error; } --=20 2.17.1