Re: [PATCH] usb: renesas_usbhs: bugfix: use irqnum = -1 for usb_add_hcd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 28 Feb 2012, Felipe Balbi wrote:

> the bug is this check. IRQ 0 mean NO_IRQ. Alan, Greg, Sarah, would you
> take the following:
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index eb19cba..cffbd2dc 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -2571,7 +2571,7 @@ void usb_remove_hcd(struct usb_hcd *hcd)
>  	del_timer_sync(&hcd->rh_timer);
>  
>  	if (usb_hcd_is_primary_hcd(hcd)) {
> -		if (hcd->irq >= 0)
> +		if (hcd->irq > 0)
>  			free_irq(hcd->irq, hcd);
>  	}

That's fine, but it doesn't go far enough.  The invalid >= 0 comparison 
is also made near the end of usb_add_hcd(), and usb_hcd_request_irqs() 
sets an unused value to -1 rather than setting it to 0.

Also, while you're at it, you might as well change the irq field in
struct usb_hcd to unsigned (if doing so doesn't cause too many
problems).  That's how IRQ numbers are handled everywhere else in the
kernel.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux