2020-05-20 03:21:23

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH -next] bus: arm-integrator-lm: Fix return value check in integrator_ap_lm_probe()

In case of error, the function of_find_matching_node() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: ccea5e8a5918 ("bus: Add driver for Integrator/AP logic modules")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/bus/arm-integrator-lm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/arm-integrator-lm.c b/drivers/bus/arm-integrator-lm.c
index 669ea7e1f92e..845b6c43fef8 100644
--- a/drivers/bus/arm-integrator-lm.c
+++ b/drivers/bus/arm-integrator-lm.c
@@ -78,10 +78,10 @@ static int integrator_ap_lm_probe(struct platform_device *pdev)

/* Look up the system controller */
syscon = of_find_matching_node(NULL, integrator_ap_syscon_match);
- if (IS_ERR(syscon)) {
+ if (!syscon) {
dev_err(dev,
"could not find Integrator/AP system controller\n");
- return PTR_ERR(syscon);
+ return -ENODEV;
}
map = syscon_node_to_regmap(syscon);
if (IS_ERR(map)) {




2020-05-25 09:20:32

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH -next] bus: arm-integrator-lm: Fix return value check in integrator_ap_lm_probe()

Hi Wei,

On Wed, May 20, 2020 at 5:18 AM Wei Yongjun <[email protected]> wrote:

> In case of error, the function of_find_matching_node() returns NULL
> pointer not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
>
> Fixes: ccea5e8a5918 ("bus: Add driver for Integrator/AP logic modules")
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Wei Yongjun <[email protected]>

I applied this and signed it off and sent it over to the ARM SoC
maintainers.

Yours,
Linus Walleij