Skip to content

Commit dc62f95

Browse files
Wei Yongjunbroonie
authored andcommitted
regulator: stm32-pwr: Fix return value check in stm32_pwr_regulator_probe()
In case of error, the function of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 6cdae81 ("regulator: Add support for stm32 power regulators") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 82f2618 commit dc62f95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/regulator/stm32-pwr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ static int stm32_pwr_regulator_probe(struct platform_device *pdev)
140140
int i, ret = 0;
141141

142142
base = of_iomap(np, 0);
143-
if (IS_ERR(base)) {
143+
if (!base) {
144144
dev_err(&pdev->dev, "Unable to map IO memory\n");
145-
return PTR_ERR(base);
145+
return -ENOMEM;
146146
}
147147

148148
config.dev = &pdev->dev;

0 commit comments

Comments
 (0)