2021-03-05 03:42:07

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe()

From: Wei Yongjun <[email protected]>

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: 9351ab8b0cb6 ("regulator: rt4831: Adds support for Richtek RT4831 DSV regulator")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/regulator/rt4831-regulator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/rt4831-regulator.c b/drivers/regulator/rt4831-regulator.c
index 3d4695ded629..e3aaac90d238 100644
--- a/drivers/regulator/rt4831-regulator.c
+++ b/drivers/regulator/rt4831-regulator.c
@@ -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 */


2021-03-08 16:11:15

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe()

On Fri, 5 Mar 2021 03:49:30 +0000, 'Wei Yongjun wrote:
> 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.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: rt4831: Fix return value check in rt4831_regulator_probe()
commit: 2a105d168e74eedbccd9b040c3ee8b8b00604a33

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

2021-03-11 03:28:07

by ChiYuan Huang

[permalink] [raw]
Subject: Re: [PATCH -next] regulator: rt4831: Fix return value check in rt4831_regulator_probe()

Many thanks to fix it. I didn't notice this fault.
> dev_err(&pdev->dev, "Failed to init regmap\n");
> -return PTR_ERR(regmap);
> +return -ENODEV;
> }
>
> /* Configure DSV mode to normal by default */
>
************* Email Confidentiality Notice ********************

The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!