]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/usb/chipidea/udc.c
Merge remote-tracking branch 'usb-chipidea-next/ci-for-usb-next'
[karo-tx-linux.git] / drivers / usb / chipidea / udc.c
index 391a1225b0ba330cd818028f240cb151e8ade65c..2987a742ca3bef8251de32e8009e5727fd12312e 100644 (file)
@@ -26,7 +26,6 @@
 #include "ci.h"
 #include "udc.h"
 #include "bits.h"
-#include "debug.h"
 #include "otg.h"
 #include "otg_fsm.h"
 
@@ -404,9 +403,9 @@ static inline u8 _usb_addr(struct ci_hw_ep *ep)
 }
 
 /**
- * _hardware_queue: configures a request at hardware level
- * @gadget: gadget
+ * _hardware_enqueue: configures a request at hardware level
  * @hwep:   endpoint
+ * @hwreq:  request
  *
  * This function returns an error code
  */
@@ -435,19 +434,28 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
        if (hwreq->req.dma % PAGE_SIZE)
                pages--;
 
-       if (rest == 0)
-               add_td_to_list(hwep, hwreq, 0);
+       if (rest == 0) {
+               ret = add_td_to_list(hwep, hwreq, 0);
+               if (ret < 0)
+                       goto done;
+       }
 
        while (rest > 0) {
                unsigned count = min(hwreq->req.length - hwreq->req.actual,
                                        (unsigned)(pages * CI_HDRC_PAGE_SIZE));
-               add_td_to_list(hwep, hwreq, count);
+               ret = add_td_to_list(hwep, hwreq, count);
+               if (ret < 0)
+                       goto done;
+
                rest -= count;
        }
 
        if (hwreq->req.zero && hwreq->req.length && hwep->dir == TX
-           && (hwreq->req.length % hwep->ep.maxpacket == 0))
-               add_td_to_list(hwep, hwreq, 0);
+           && (hwreq->req.length % hwep->ep.maxpacket == 0)) {
+               ret = add_td_to_list(hwep, hwreq, 0);
+               if (ret < 0)
+                       goto done;
+       }
 
        firstnode = list_first_entry(&hwreq->tds, struct td_node, td);
 
@@ -788,8 +796,12 @@ static void isr_get_status_complete(struct usb_ep *ep, struct usb_request *req)
 
 /**
  * _ep_queue: queues (submits) an I/O request to an endpoint
+ * @ep:        endpoint
+ * @req:       request
+ * @gfp_flags: GFP flags (not used)
  *
  * Caller must hold lock
+ * This function returns an error code
  */
 static int _ep_queue(struct usb_ep *ep, struct usb_request *req,
                    gfp_t __maybe_unused gfp_flags)