staging: octeon-usb: use list_for_each_entry_safe()
authorAaro Koskinen <aaro.koskinen@iki.fi>
Thu, 10 Oct 2013 20:25:34 +0000 (23:25 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Oct 2013 22:46:00 +0000 (15:46 -0700)
Use list_for_each_entry_safe() when deleting all list items.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/octeon-usb/octeon-hcd.c

index 632190aa2ee4307687de12b0fe515fb3a7f35397..8e0fcbd173f219ced4bbf0390e131cdc691a0173 100644 (file)
@@ -3223,13 +3223,14 @@ static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
 
 static void octeon_usb_urb_dequeue_work(unsigned long arg)
 {
+       struct urb *urb;
+       struct urb *next;
        unsigned long flags;
        struct octeon_hcd *priv = (struct octeon_hcd *)arg;
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       while (!list_empty(&priv->dequeue_list)) {
-               struct urb *urb = container_of(priv->dequeue_list.next, struct urb, urb_list);
+       list_for_each_entry_safe(urb, next, &priv->dequeue_list, urb_list) {
                list_del_init(&urb->urb_list);
                cvmx_usb_cancel(&priv->usb, urb->ep->hcpriv, urb->hcpriv);
        }