diff mbox series

[-next,v2] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq()

Message ID 20230803114246.79820-1-wangzhu9@huawei.com (mailing list archive)
State Superseded
Headers show
Series [-next,v2] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq() | expand

Commit Message

wangzhu Aug. 3, 2023, 11:42 a.m. UTC
When platform_get_irq_byname() is called to get a interrupt number, it
may return -EINVAL or -ENXIO when failed, while current code returned
-ENODEV, so we replace it with the return value of
platform_get_irq_byname(). And we found that platform_get_irq_byname()
never returned zero by reading its code.

Commit ce753ad1549c ("platform: finally disallow IRQ0 in
platform_get_irq() and its ilk") makes sure IRQ0 is not returned.

Signed-off-by: Zhu Wang <wangzhu9@huawei.com>

---
Changes in v2:
- Update the commit message, present the reason of replacing the return
value of the probe.
---
 drivers/usb/gadget/udc/gr_udc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Herve Codina Aug. 3, 2023, 11:55 a.m. UTC | #1
Hi Zhu,

On Thu, 3 Aug 2023 19:42:46 +0800
Zhu Wang <wangzhu9@huawei.com> wrote:

> When platform_get_irq_byname() is called to get a interrupt number, it
> may return -EINVAL or -ENXIO when failed, while current code returned
> -ENODEV, so we replace it with the return value of
> platform_get_irq_byname(). And we found that platform_get_irq_byname()
> never returned zero by reading its code.

The function involve in the code is not platform_get_irq_byname() but
platform_get_irq(). Can you update ?

With this updated,
Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé

> 
> Commit ce753ad1549c ("platform: finally disallow IRQ0 in
> platform_get_irq() and its ilk") makes sure IRQ0 is not returned.
> 
> Signed-off-by: Zhu Wang <wangzhu9@huawei.com>
> 
> ---
> Changes in v2:
> - Update the commit message, present the reason of replacing the return
> value of the probe.
> ---
>  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;
>  	}
diff mbox series

Patch

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;
 	}