All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe()
@ 2021-03-05  3:49 'Wei Yongjun
  2021-03-08 16:08 ` Mark Brown
  2021-03-11  3:16 ` cy_huang(黃啟原)
  0 siblings, 2 replies; 3+ messages in thread
From: 'Wei Yongjun @ 2021-03-05  3:49 UTC (permalink / raw)
  To: weiyongjun1, Liam Girdwood, Mark Brown, ChiYuan Huang
  Cc: linux-kernel, kernel-janitors, Hulk Robot

From: Wei Yongjun <weiyongjun1@huawei.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@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.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 */


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-11  3:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-05  3:49 [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe() 'Wei Yongjun
2021-03-08 16:08 ` Mark Brown
2021-03-11  3:16 ` cy_huang(黃啟原)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.