Commit e9e7fce0 authored by Wei Yongjun's avatar Wei Yongjun Committed by Mark Brown

regulator: rt4831: Fix return value check in rt4831_regulator_probe()

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: 9351ab8b ("regulator: rt4831: Adds support for Richtek RT4831 DSV regulator")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210305034930.3236099-1-weiyongjun1@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 98b94b6e
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment