Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] usb: bdc: Fix return value of bdc_probe()
@ 2020-05-22  8:17 Tiezhu Yang
  2020-05-22  9:10 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2020-05-22  8:17 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-usb, linux-kernel, Xuefeng Li, Tiezhu Yang

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@loongson.cn>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: bdc: Fix return value of bdc_probe()
  2020-05-22  8:17 [PATCH] usb: bdc: Fix return value of bdc_probe() Tiezhu Yang
@ 2020-05-22  9:10 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2020-05-22  9:10 UTC (permalink / raw)
  To: Tiezhu Yang, Felipe Balbi; +Cc: linux-usb, linux-kernel, Xuefeng Li

Hello!

On 22.05.2020 11:17, Tiezhu Yang wrote:

> When call function devm_platform_ioremap_resource(), we should use IS_ERR()
> to check the return value

    Already done.

> and return PTR_ERR() if failed.

   Yes, else the deferred probing doesn't work.

> Fixes: 893a66d34298 ("usb: bdc: use devm_platform_ioremap_resource() to simplify code")
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  8:17 [PATCH] usb: bdc: Fix return value of bdc_probe() Tiezhu Yang
2020-05-22  9:10 ` Sergei Shtylyov

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git