linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq()
@ 2023-08-03  6:41 Zhu Wang
  2023-08-03 11:17 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: Zhu Wang @ 2023-08-03  6:41 UTC (permalink / raw)
  To: gregkh, robh, stern, aaro.koskinen, linux-usb; +Cc: wangzhu9

Since platform_get_irq() never returned zero, so it need not to check
whether it returned zero, and we use the return error code of
platform_get_irq() to replace the current return error code.

Please refer to the commit a85a6c86c25b ("driver core: platform: Clarify
that IRQ 0 is invalid") to get that platform_get_irq() never returned
zero.

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
---
 drivers/usb/gadget/udc/gr_udc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c
index 0c3969301a53..c6dfa7cccc11 100644
--- a/drivers/usb/gadget/udc/gr_udc.c
+++ b/drivers/usb/gadget/udc/gr_udc.c
@@ -2136,15 +2136,15 @@ static int gr_probe(struct platform_device *pdev)
 		return PTR_ERR(regs);
 
 	dev->irq = platform_get_irq(pdev, 0);
-	if (dev->irq <= 0)
-		return -ENODEV;
+	if (dev->irq < 0)
+		return dev->irq;
 
 	/* Some core configurations has separate irqs for IN and OUT events */
 	dev->irqi = platform_get_irq(pdev, 1);
 	if (dev->irqi > 0) {
 		dev->irqo = platform_get_irq(pdev, 2);
-		if (dev->irqo <= 0)
-			return -ENODEV;
+		if (dev->irqo < 0)
+			return dev->irqo;
 	} else {
 		dev->irqi = 0;
 	}
-- 
2.17.1


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

* Re: [PATCH -next] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq()
  2023-08-03  6:41 [PATCH -next] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq() Zhu Wang
@ 2023-08-03 11:17 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2023-08-03 11:17 UTC (permalink / raw)
  To: Zhu Wang, gregkh, robh, stern, aaro.koskinen, linux-usb

On 8/3/23 9:41 AM, Zhu Wang wrote:

> Since platform_get_irq() never returned zero, so it need not to check
> whether it returned zero, and we use the return error code of
> platform_get_irq() to replace the current return error code.
> 
> Please refer to the commit a85a6c86c25b ("driver core: platform: Clarify
> that IRQ 0 is invalid") to get that platform_get_irq() never returned
> zero.
> 
> Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
[...]

   Same comments as to the MUSB driver...

MBR, Sergey

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

end of thread, other threads:[~2023-08-03 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-03  6:41 [PATCH -next] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq() Zhu Wang
2023-08-03 11:17 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).