diff mbox series

[-next] usb: fotg210: fix return value check in fotg210_probe()

Message ID 20230129075204.297725-1-yangyingliang@huawei.com
State New
Headers show
Series [-next] usb: fotg210: fix return value check in fotg210_probe() | expand

Commit Message

Yang Yingliang Jan. 29, 2023, 7:52 a.m. UTC
devm_platform_get_and_ioremap_resource() never returns NULL pointer,
it will return ERR_PTR() when it fails, so replace the check with
IS_ERR().

Fixes: baef5330d35b ("usb: fotg210: Acquire memory resource in core")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/usb/fotg210/fotg210-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Jan. 30, 2023, 2:54 p.m. UTC | #1
On Sun, Jan 29, 2023 at 8:34 AM Yang Yingliang <yangyingliang@huawei.com> wrote:

> devm_platform_get_and_ioremap_resource() never returns NULL pointer,
> it will return ERR_PTR() when it fails, so replace the check with
> IS_ERR().
>
> Fixes: baef5330d35b ("usb: fotg210: Acquire memory resource in core")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Good catch!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/usb/fotg210/fotg210-core.c b/drivers/usb/fotg210/fotg210-core.c
index 202d80adca2c..fad49f523dee 100644
--- a/drivers/usb/fotg210/fotg210-core.c
+++ b/drivers/usb/fotg210/fotg210-core.c
@@ -136,7 +136,7 @@  static int fotg210_probe(struct platform_device *pdev)
 	fotg->dev = dev;
 
 	fotg->base = devm_platform_get_and_ioremap_resource(pdev, 0, &fotg->res);
-	if (!fotg->base)
+	if (IS_ERR(fotg->base))
 		return -ENOMEM;
 
 	fotg->pclk = devm_clk_get_optional_enabled(dev, "PCLK");