[PATCH] usb: bdc: Fix return value of bdc_probe()

From: Tiezhu Yang
Date: Fri May 22 2020 - 04:17:53 EST


When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Fixes: 893a66d34298 ("usb: bdc: use devm_platform_ioremap_resource() to simplify code")
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
drivers/usb/gadget/udc/bdc/bdc_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index 02a3a77..c48fdd3 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -510,7 +510,7 @@ static int bdc_probe(struct platform_device *pdev)
bdc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(bdc->regs)) {
dev_err(dev, "ioremap error\n");
- return -ENOMEM;
+ return PTR_ERR(bdc->regs);
}
irq = platform_get_irq(pdev, 0);
if (irq < 0)
--
2.1.0