diff mbox series

[01/10] usb: gadget: udc: bcm63xx: fix deferred probing

Message ID 20211021191437.8737-2-s.shtylyov@omp.ru (mailing list archive)
State Superseded
Headers show
Series Fix deferred probing in the USB host/gadget drivers | expand

Commit Message

Sergey Shtylyov Oct. 21, 2021, 7:14 p.m. UTC
The driver overrides the error codes returned by platform_get_irq() to
-ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver
will fail the probe permanently instead of the deferred probing. Switch to
propagating the error codes upstream.

Fixes: 613065e53cb1 ("usb: gadget: bcm63xx UDC driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Florian Fainelli Oct. 26, 2021, 9:33 p.m. UTC | #1
On 10/21/21 12:14 PM, Sergey Shtylyov wrote:
> The driver overrides the error codes returned by platform_get_irq() to
> -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver
> will fail the probe permanently instead of the deferred probing. Switch to
> propagating the error codes upstream.
> 
> Fixes: 613065e53cb1 ("usb: gadget: bcm63xx UDC driver")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Not that this is going to happen for this particular driver on the
platform where it is use MIPS BCM63XX but this is still the right thing
to do anyway.
Sergey Shtylyov Dec. 10, 2021, 7:53 p.m. UTC | #2
On 10/27/21 12:33 AM, Florian Fainelli wrote:

>> The driver overrides the error codes returned by platform_get_irq() to
>> -ENXIO for some strange reason, so if it returns -EPROBE_DEFER, the driver
>> will fail the probe permanently instead of the deferred probing. Switch to
>> propagating the error codes upstream.
>>
>> Fixes: 613065e53cb1 ("usb: gadget: bcm63xx UDC driver")
>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Not that this is going to happen for this particular driver on the
> platform where it is use MIPS BCM63XX

   Thanks for noting that. I think I should re-qualify this patch from
a bug fix to cleanup. I'll split the series into 2 parts now.

> but this is still the right thing
> to do anyway.

   Yes, propagating the error is the Right Thing. :-)

MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c
index a9f07c59fc37..2cdb07905bde 100644
--- a/drivers/usb/gadget/udc/bcm63xx_udc.c
+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c
@@ -2321,8 +2321,10 @@  static int bcm63xx_udc_probe(struct platform_device *pdev)
 
 	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
+	if (irq < 0) {
+		rc = irq;
 		goto out_uninit;
+	}
 	if (devm_request_irq(dev, irq, &bcm63xx_udc_ctrl_isr, 0,
 			     dev_name(dev), udc) < 0)
 		goto report_request_failure;
@@ -2330,8 +2332,10 @@  static int bcm63xx_udc_probe(struct platform_device *pdev)
 	/* IRQ resources #1-6: data interrupts for IUDMA channels 0-5 */
 	for (i = 0; i < BCM63XX_NUM_IUDMA; i++) {
 		irq = platform_get_irq(pdev, i + 1);
-		if (irq < 0)
+		if (irq < 0) {
+			rc = irq;
 			goto out_uninit;
+		}
 		if (devm_request_irq(dev, irq, &bcm63xx_udc_data_isr, 0,
 				     dev_name(dev), &udc->iudma[i]) < 0)
 			goto report_request_failure;