Skip to content

Commit e9e7fce

Browse files
Wei Yongjunbroonie
authored andcommitted
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: 9351ab8 ("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>
1 parent 98b94b6 commit e9e7fce

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/regulator/rt4831-regulator.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ static int rt4831_regulator_probe(struct platform_device *pdev)
153153
int i, ret;
154154

155155
regmap = dev_get_regmap(pdev->dev.parent, NULL);
156-
if (IS_ERR(regmap)) {
156+
if (!regmap) {
157157
dev_err(&pdev->dev, "Failed to init regmap\n");
158-
return PTR_ERR(regmap);
158+
return -ENODEV;
159159
}
160160

161161
/* Configure DSV mode to normal by default */

0 commit comments

Comments
 (0)