Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: n64joy - fix return value check in n64joy_probe()

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 <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Lauri Kasanen <cand@gmx.com>
Link: https://lore.kernel.org/r/20210308122856.2177071-1-weiyongjun1@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Wei Yongjun and committed by
Dmitry Torokhov
2d8aaa17 30b3f687

+2 -2
+2 -2
drivers/input/joystick/n64joy.c
··· 252 252 mutex_init(&priv->n64joy_mutex); 253 253 254 254 priv->reg_base = devm_platform_ioremap_resource(pdev, 0); 255 - if (!priv->reg_base) { 256 - err = -EINVAL; 255 + if (IS_ERR(priv->reg_base)) { 256 + err = PTR_ERR(priv->reg_base); 257 257 goto fail; 258 258 } 259 259