[PATCH -next] Input: n64joy - Fix return value check in n64joy_probe()

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE2042d LANDED

Landed in mainline as 2d8aaa1720c6 on 2021-03-10.

3 messages, 3 authors, 2021-03-08 · open the first message on its own page

[PATCH -next] Input: n64joy - Fix return value check in n64joy_probe()

From: 'Wei Yongjun <hidden>
Date: 2021-03-08 12:20:51

From: Wei Yongjun <redacted>

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

Fixes: 3bdffa8ffb45 ("Input: Add N64 controller driver")
Reported-by: Hulk Robot <redacted>
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/input/joystick/n64joy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/input/joystick/n64joy.c b/drivers/input/joystick/n64joy.c
index 8bcc529942bc..9dbca366613e 100644
--- a/drivers/input/joystick/n64joy.c
+++ b/drivers/input/joystick/n64joy.c
@@ -252,8 +252,8 @@ static int __init n64joy_probe(struct platform_device *pdev)
 	mutex_init(&priv->n64joy_mutex);
 
 	priv->reg_base = devm_platform_ioremap_resource(pdev, 0);
-	if (!priv->reg_base) {
-		err = -EINVAL;
+	if (IS_ERR(priv->reg_base)) {
+		err = PTR_ERR(priv->reg_base);
 		goto fail;
 	}
 

Re: [PATCH -next] Input: n64joy - Fix return value check in n64joy_probe()

From: Lauri Kasanen <hidden>
Date: 2021-03-08 13:42:05

On Mon, 8 Mar 2021 12:28:56 +0000
'Wei Yongjun [off-list ref] wrote:
From: Wei Yongjun <redacted>

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

Fixes: 3bdffa8ffb45 ("Input: Add N64 controller driver")
Reported-by: Hulk Robot <redacted>
Signed-off-by: Wei Yongjun <redacted>
Reviewed-by: Lauri Kasanen <redacted>

- Lauri

Re: [PATCH -next] Input: n64joy - Fix return value check in n64joy_probe()

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2021-03-08 19:41:35

On Mon, Mar 08, 2021 at 12:28:56PM +0000, 'Wei Yongjun wrote:
From: Wei Yongjun <redacted>

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

Fixes: 3bdffa8ffb45 ("Input: Add N64 controller driver")
Reported-by: Hulk Robot <redacted>
Signed-off-by: Wei Yongjun <redacted>
Applied, thank you.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help