Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1707932pxb; Thu, 4 Mar 2021 19:42:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzViKa90pGxsKF9L3OUF6CMoixRnTO2PprOENB7OXYZpJJGtmMlOAcN9x2XY+HUK7LrjTQS X-Received: by 2002:a17:906:35cf:: with SMTP id p15mr547342ejb.379.1614915727116; Thu, 04 Mar 2021 19:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614915727; cv=none; d=google.com; s=arc-20160816; b=Kp4OiJ/iBnGZNJJm7fGqykmdrHwx/DODJE1dFL9n9FnOrgnVA+ICeTNtyMIZbcI9es JlpTV0Sdd3mxBbh83FyKWCcFWqWzP/kstgTc9qXNEjCQqKgjs6p5C4IwPIrUsF0Gma1x CaxsNQXSGz5S0Yfm/wX1IeeOpCxKWeDLDM8qA0GGdyFZjq9ftFx1eeNzqIGonEKxJoFV d7HoEHSL4q86FDUhoCxdeSSz4538dHbMOLkU9EjMiE557DhI8QWpzv0Ja/7yRJis6Wil +elYi3kTzCjyy+ofG2Q1Gif1W1Z9feD5DYLz2t2xaxPST0dSIUVaSsyLOpM17/gQ2b1E Xfow== 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=LaDMzpr8am7Q4VFqlWACp8u1GVW5Bwhz+vVrWTpYxrI=; b=UWvQQ39HD6hO861/P4b0YHXEc3t80uBsN03T6xqltDccD3BnRdFV1LyPwkPRyjwoU1 1D4pygb9wGAVMGIrKzqS4Wyo7tUBhbku9Qu11LFhKU1gmx1hU3YFbbDblZcqwom94wSR q62VyfbAiJqettLEoeuFU12TKps3ZIT26yNX1Sng1Slg+hFxefnysZjOEMzWt0mxQMwq 1jH82CzbadCcHofW2CDE7AHnL8onsTSfY4KUfvfk9ci2hJtP+PTZ0P7RjYVPoqh7xtg7 eOuMTezA6YcXDy8afYxATrev2/K/8DjnOPk9RZXUqylhRqX2DvUoXaLw0r7nb+Bs6RaW aWRQ== 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 cb23si619394ejb.496.2021.03.04.19.41.41; Thu, 04 Mar 2021 19:42:07 -0800 (PST) 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 S229629AbhCEDkt (ORCPT + 99 others); Thu, 4 Mar 2021 22:40:49 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:13127 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbhCEDkr (ORCPT ); Thu, 4 Mar 2021 22:40:47 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DsD4639DVz16Ft2; Fri, 5 Mar 2021 11:39:02 +0800 (CST) Received: from localhost.localdomain (10.175.102.38) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Fri, 5 Mar 2021 11:40:34 +0800 From: 'Wei Yongjun To: , Liam Girdwood , Mark Brown , ChiYuan Huang CC: , , "Hulk Robot" Subject: [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe() Date: Fri, 5 Mar 2021 03:49:30 +0000 Message-ID: <20210305034930.3236099-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Originating-IP: [10.175.102.38] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Yongjun In case of error, the function dev_get_regmap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 9351ab8b0cb6 ("regulator: rt4831: Adds support for Richtek RT4831 DSV regulator") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- drivers/regulator/rt4831-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/rt4831-regulator.c b/drivers/regulator/rt4831-regulator.c index 3d4695ded629..e3aaac90d238 100644 --- a/drivers/regulator/rt4831-regulator.c +++ b/drivers/regulator/rt4831-regulator.c @@ -153,9 +153,9 @@ static int rt4831_regulator_probe(struct platform_device *pdev) int i, ret; regmap = dev_get_regmap(pdev->dev.parent, NULL); - if (IS_ERR(regmap)) { + if (!regmap) { dev_err(&pdev->dev, "Failed to init regmap\n"); - return PTR_ERR(regmap); + return -ENODEV; } /* Configure DSV mode to normal by default */