static int pxa25x_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 {
        struct pxa25x_ep        *ep;
-       struct pxa25x_request   *req;
+       struct pxa25x_request   *req = NULL;
+       struct pxa25x_request   *iter;
        unsigned long           flags;
 
        ep = container_of(_ep, struct pxa25x_ep, ep);
        local_irq_save(flags);
 
        /* make sure it's actually queued on this endpoint */
-       list_for_each_entry (req, &ep->queue, queue) {
-               if (&req->req == _req)
-                       break;
+       list_for_each_entry(iter, &ep->queue, queue) {
+               if (&iter->req != _req)
+                       continue;
+               req = iter;
+               break;
        }
-       if (&req->req != _req) {
+       if (!req) {
                local_irq_restore(flags);
                return -EINVAL;
        }