Commit 1fa63e43e64596455938e09d3e6ec89eb0c4bbc8

Authored by Michael Buesch
Committed by Anthony Liguori
1 parent e6a0575e

usb-ohci: Fix endianness issue

This fixes a possible endianness issue in the usb-ohci hw module.
hcca.frame and ohci->frame_number are 16bit, so use cpu_to_le16().

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 2 additions and 2 deletions
hw/usb-ohci.c
@@ -1150,9 +1150,9 @@ static void ohci_frame_boundary(void *opaque) @@ -1150,9 +1150,9 @@ static void ohci_frame_boundary(void *opaque)
1150 /* Frame boundary, so do EOF stuf here */ 1150 /* Frame boundary, so do EOF stuf here */
1151 ohci->frt = ohci->fit; 1151 ohci->frt = ohci->fit;
1152 1152
1153 - /* XXX: endianness */ 1153 + /* Increment frame number and take care of endianness. */
1154 ohci->frame_number = (ohci->frame_number + 1) & 0xffff; 1154 ohci->frame_number = (ohci->frame_number + 1) & 0xffff;
1155 - hcca.frame = cpu_to_le32(ohci->frame_number); 1155 + hcca.frame = cpu_to_le16(ohci->frame_number);
1156 1156
1157 if (ohci->done_count == 0 && !(ohci->intr_status & OHCI_INTR_WD)) { 1157 if (ohci->done_count == 0 && !(ohci->intr_status & OHCI_INTR_WD)) {
1158 if (!ohci->done) 1158 if (!ohci->done)