These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / octeon-usb / octeon-hcd.c
index 9e5476e..6f28717 100644 (file)
@@ -499,15 +499,21 @@ static int octeon_alloc_temp_buffer(struct urb *urb, gfp_t mem_flags)
 static void octeon_free_temp_buffer(struct urb *urb)
 {
        struct octeon_temp_buffer *temp;
+       size_t length;
 
        if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
                return;
 
        temp = container_of(urb->transfer_buffer, struct octeon_temp_buffer,
                            data);
-       if (usb_urb_dir_in(urb))
-               memcpy(temp->orig_buffer, urb->transfer_buffer,
-                      urb->actual_length);
+       if (usb_urb_dir_in(urb)) {
+               if (usb_pipeisoc(urb->pipe))
+                       length = urb->transfer_buffer_length;
+               else
+                       length = urb->actual_length;
+
+               memcpy(temp->orig_buffer, urb->transfer_buffer, length);
+       }
        urb->transfer_buffer = temp->orig_buffer;
        urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
        kfree(temp);
@@ -1233,7 +1239,7 @@ static int cvmx_usb_fill_tx_hw(struct cvmx_usb_state *usb,
                                                        usb->index) ^ 4;
                int words = available;
 
-               /* Limit the amount of data to waht the SW fifo has */
+               /* Limit the amount of data to what the SW fifo has */
                if (fifo->entry[i].size <= available) {
                        words = fifo->entry[i].size;
                        fifo->tail++;
@@ -1843,7 +1849,7 @@ static void cvmx_usb_start_channel(struct cvmx_usb_state *usb, int channel,
                transaction->xfersize = usbc_hctsiz.s.xfersize;
                transaction->pktcnt = usbc_hctsiz.s.pktcnt;
        }
-       /* Remeber when we start a split transaction */
+       /* Remember when we start a split transaction */
        if (cvmx_usb_pipe_needs_split(usb, pipe))
                usb->active_split = transaction;
        USB_SET_FIELD32(CVMX_USBCX_HCCHARX(channel, usb->index),
@@ -3210,9 +3216,9 @@ static int octeon_usb_urb_enqueue(struct usb_hcd *hcd,
                 * Allocate a structure to use for our private list of
                 * isochronous packets.
                 */
-               iso_packet = kmalloc(urb->number_of_packets *
-                                    sizeof(struct cvmx_usb_iso_packet),
-                                    GFP_ATOMIC);
+               iso_packet = kmalloc_array(urb->number_of_packets,
+                                          sizeof(struct cvmx_usb_iso_packet),
+                                          GFP_ATOMIC);
                if (iso_packet) {
                        int i;
                        /* Fill the list with the data from the URB */
@@ -3737,6 +3743,7 @@ static const struct of_device_id octeon_usb_match[] = {
        },
        {},
 };
+MODULE_DEVICE_TABLE(of, octeon_usb_match);
 
 static struct platform_driver octeon_usb_driver = {
        .driver = {