Message ID | 20230803064129.74313-1-wangzhu9@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [-next] usb: gadget: udc: gr_udc: Do not check 0 for platform_get_irq() | expand |
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
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; }
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(-)