Subject: Re: [PATCH 2/6] usb/fsl_qe_udc: Fix recursive locking bug in ch9getstatus()

From: David Brownell <[email-masked]>
Date: Mon, 17 Nov 2008 17:59:42 -0800

On Tuesday 11 November 2008, Anton Vorontsov wrote:
> -       spin_lock_irqsave(&udc->lock, flags);
> +       if (lock)
> +               spin_lock_irqsave(lock, flags);

Ugly ugly ugly.  Conditional locking is error prone ... don't.

Couldn't you just have the usb_ep_queue() method wrap lock calls
around a common routine called by that and the status reporting code?

Or just have the status reporting code stuff the two bytes directly
into the FIFO?  (Which is what a lot of other drivers do.)

- Dave