[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210305034930.3236099-1-weiyongjun1@huawei.com>
Date: Fri, 5 Mar 2021 03:49:30 +0000
From: 'Wei Yongjun <weiyongjun1@...wei.com>
To: <weiyongjun1@...wei.com>, Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
ChiYuan Huang <cy_huang@...htek.com>
CC: <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>,
"Hulk Robot" <hulkci@...wei.com>
Subject: [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe()
From: Wei Yongjun <weiyongjun1@...wei.com>
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 <hulkci@...wei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
---
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 */
Powered by blists - more mailing lists