[haiku-commits] haiku: hrev53863 - src/add-ons/kernel/busses/usb

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 9 Feb 2020 17:35:28 -0500 (EST)

hrev53863 adds 1 changeset to branch 'master'
old head: 11d738a430658b512d53ae7376c3639302ef7fb2
new head: 877c1b934f3c67dbbb7f8826fc4efcbe52ee56ba
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=877c1b934f3c+%5E11d738a43065

----------------------------------------------------------------------------

877c1b934f3c: EHCI: Call InitKernelAccess at the top of SubmitTransfer 
functions.
  
  I missed that this was not done before WriteDescriptor was called.
  Fixes #14835 (again.)

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53863
Commit:      877c1b934f3c67dbbb7f8826fc4efcbe52ee56ba
URL:         https://git.haiku-os.org/haiku/commit/?id=877c1b934f3c
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Feb  9 22:32:57 2020 UTC

Ticket:      https://dev.haiku-os.org/ticket/14835

----------------------------------------------------------------------------

1 file changed, 10 insertions(+), 14 deletions(-)
src/add-ons/kernel/busses/usb/ehci.cpp | 24 ++++++++++--------------

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp 
b/src/add-ons/kernel/busses/usb/ehci.cpp
index 32fc3e18d7..c003bb267c 100644
--- a/src/add-ons/kernel/busses/usb/ehci.cpp
+++ b/src/add-ons/kernel/busses/usb/ehci.cpp
@@ -971,13 +971,17 @@ EHCI::SubmitTransfer(Transfer *transfer)
        if ((pipe->Type() & USB_OBJECT_ISO_PIPE) != 0)
                return SubmitIsochronous(transfer);
 
+       status_t result = transfer->InitKernelAccess();
+       if (result != B_OK)
+               return result;
+
        ehci_qh *queueHead = CreateQueueHead();
        if (!queueHead) {
                TRACE_ERROR("failed to allocate queue head\n");
                return B_NO_MEMORY;
        }
 
-       status_t result = InitQueueHead(queueHead, pipe);
+       result = InitQueueHead(queueHead, pipe);
        if (result != B_OK) {
                TRACE_ERROR("failed to init queue head\n");
                FreeQueueHead(queueHead);
@@ -1047,6 +1051,10 @@ EHCI::SubmitIsochronous(Transfer *transfer)
                return B_BAD_VALUE;
        }
 
+       status_t result = transfer->InitKernelAccess();
+       if (result != B_OK)
+               return result;
+
        // Ignore the fact that the last descriptor might need less bandwidth.
        // The overhead is not worthy.
        uint16 bandwidth = transfer->Bandwidth() / 
isochronousData->packet_count;
@@ -1172,7 +1180,7 @@ EHCI::SubmitIsochronous(Transfer *transfer)
        TRACE("isochronous filled itds count %d\n", itdIndex);
 
        // Add transfer to the list
-       status_t result = AddPendingIsochronousTransfer(transfer, isoRequest,
+       result = AddPendingIsochronousTransfer(transfer, isoRequest,
                itdIndex - 1, directionIn, bufferPhy, bufferLog,
                transfer->DataLength());
        if (result != B_OK) {
@@ -1527,12 +1535,6 @@ EHCI::AddPendingTransfer(Transfer *transfer, ehci_qh 
*queueHead,
        if (!data)
                return B_NO_MEMORY;
 
-       status_t result = transfer->InitKernelAccess();
-       if (result != B_OK) {
-               delete data;
-               return result;
-       }
-
        data->transfer = transfer;
        data->queue_head = queueHead;
        data->data_descriptor = dataDescriptor;
@@ -1570,12 +1572,6 @@ EHCI::AddPendingIsochronousTransfer(Transfer *transfer, 
ehci_itd **isoRequest,
        if (!data)
                return B_NO_MEMORY;
 
-       status_t result = transfer->InitKernelAccess();
-       if (result != B_OK) {
-               delete data;
-               return result;
-       }
-
        data->transfer = transfer;
        data->descriptors = isoRequest;
        data->last_to_process = lastIndex;


Other related posts:

  • » [haiku-commits] haiku: hrev53863 - src/add-ons/kernel/busses/usb - waddlesplash