Re: [PATCH 4/5] USB: add Cypress c67x00 OTG controller HCD driver

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel,gmane.linux.ports.ppc64.devel
Message-ID <[email protected]>
On Fri, 23 Nov 2007, Grant Likely wrote:

> From: Grant Likely <[email protected]>
> 
> This patch adds HDC support for the Cypress c67x00 family of devices.
> 
> Signed-off-by: Grant Likely <[email protected]>

> +static void c67x00_sched_done(unsigned long __c67x00)
> +{
> +	struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
> +	struct c67x00_urb_priv *urbp, *tmp;
> +	struct usb_hcd *hcd = c67x00_hcd_to_hcd(c67x00);
> +	struct urb *urb;
> +	int status;
> +
> +	spin_lock(&c67x00->lock);
> +
> +	/* Loop over the done list and give back all the urbs */
> +	list_for_each_entry_safe(urbp, tmp, &c67x00->done_list, hep_node) {
> +		urb = urbp->urb;
> +		status = urbp->status;
> +
> +		c67x00_release_urb(c67x00, urb);
> +
> +		usb_hcd_unlink_urb_from_ep(hcd, urb);
> +		usb_hcd_giveback_urb(hcd, urb, status);
> +	}
> +	spin_unlock(&c67x00->lock);
> +}

You need to release the spinlock around the call to 
usb_hcd_giveback_urb().  Otherwise you will deadlock if the completion 
routine submits another URB.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.