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: 9351ab8b0c
("regulator: rt4831: Adds support for Richtek RT4831 DSV regulator")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20210305034930.3236099-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
98b94b6e38
commit
e9e7fce038
|
@ -153,9 +153,9 @@ static int rt4831_regulator_probe(struct platform_device *pdev)
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
regmap = dev_get_regmap(pdev->dev.parent, NULL);
|
regmap = dev_get_regmap(pdev->dev.parent, NULL);
|
||||||
if (IS_ERR(regmap)) {
|
if (!regmap) {
|
||||||
dev_err(&pdev->dev, "Failed to init regmap\n");
|
dev_err(&pdev->dev, "Failed to init regmap\n");
|
||||||
return PTR_ERR(regmap);
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure DSV mode to normal by default */
|
/* Configure DSV mode to normal by default */
|
||||||
|
|
Loading…
Reference in New Issue