diff mbox series

[04/10] usb: host: ehci-atmel: fix deferred probing

Message ID 20211021191437.8737-5-s.shtylyov@omp.ru (mailing list archive)
State New, archived
Headers show
Series [01/10] usb: gadget: udc: bcm63xx: fix deferred probing | expand

Commit Message

Sergey Shtylyov Oct. 21, 2021, 7:14 p.m. UTC
The driver overrides the error codes (and also IRQ0) returned by
platform_get_irq() to -ENODEV, 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 -- that means we have to explicitly
filter out IRQ0 as bad since usb_add_hcd() doesn't quite like it... :-)

Fixes: 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
---
 drivers/usb/host/ehci-atmel.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Alan Stern Oct. 21, 2021, 7:21 p.m. UTC | #1
On Thu, Oct 21, 2021 at 10:14:31PM +0300, Sergey Shtylyov wrote:
> The driver overrides the error codes (and also IRQ0) returned by
> platform_get_irq() to -ENODEV, 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 -- that means we have to explicitly
> filter out IRQ0 as bad since usb_add_hcd() doesn't quite like it... :-)
> 
> Fixes: 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> ---

For patches 4 - 9:

Acked-by: Alan Stern <stern@rowland.harvard.edu>

>  drivers/usb/host/ehci-atmel.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
> index 05d41fd65f25..3f7c8ccc6d7f 100644
> --- a/drivers/usb/host/ehci-atmel.c
> +++ b/drivers/usb/host/ehci-atmel.c
> @@ -104,8 +104,12 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
>  	pr_debug("Initializing Atmel-SoC USB Host Controller\n");
>  
>  	irq = platform_get_irq(pdev, 0);
> -	if (irq <= 0) {
> -		retval = -ENODEV;
> +	if (irq < 0) {
> +		retval = irq;
> +		goto fail_create_hcd;
> +	}
> +	if (!irq) {
> +		retval = -EINVAL;
>  		goto fail_create_hcd;
>  	}
>  
> -- 
> 2.26.3
>
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 05d41fd65f25..3f7c8ccc6d7f 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -104,8 +104,12 @@  static int ehci_atmel_drv_probe(struct platform_device *pdev)
 	pr_debug("Initializing Atmel-SoC USB Host Controller\n");
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0) {
-		retval = -ENODEV;
+	if (irq < 0) {
+		retval = irq;
+		goto fail_create_hcd;
+	}
+	if (!irq) {
+		retval = -EINVAL;
 		goto fail_create_hcd;
 	}