Skip to content

Commit

Permalink
regulator: rt4831: Fix return value check in rt4831_regulator_probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wei Yongjun authored and Mark Brown committed Mar 10, 2021
1 parent 98b94b6 commit e9e7fce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/regulator/rt4831-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit e9e7fce

Please sign in to comment.