Skip to contentSkip to conversation

usb: ohci: make num_ports to an unsinged integer

PATCH In review Li Qiang 2 participants 2 messages Oct 23, 2018 – Oct 29, 2018

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 usb: ohci: make num_ports to an unsinged integer

This can avoid setting OCHIState.num_ports to a negative num.

---
 hw/usb/hcd-ohci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hw/usb/hcd-ohci.c +3 -3
index 66656a1..c34cf5b 100644
@@ -57,7 +57,7 @@ typedef struct {
     qemu_irq irq;
     MemoryRegion mem;
     AddressSpace *as;
-    int num_ports;
+    uint32_t num_ports;
     const char *name;
 
     QEMUTimer *eof_timer;
@@ -1850,7 +1850,7 @@ static USBBusOps ohci_bus_ops = {
 };
 
 static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
-                          int num_ports, dma_addr_t localmem_base,
+                          uint32_t num_ports, dma_addr_t localmem_base,
                           char *masterbus, uint32_t firstport,
                           AddressSpace *as, Error **errp)
 {
@@ -1860,7 +1860,7 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
     ohci->as = as;
 
     if (num_ports > OHCI_MAX_PORTS) {
-        error_setg(errp, "OHCI num-ports=%d is too big (limit is %d ports)",
+        error_setg(errp, "OHCI num-ports=%u is too big (limit is %u ports)",
                    num_ports, OHCI_MAX_PORTS);
         return;
     }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 1 line · Li Qiang

This can avoid setting OCHIState.num_ports to a negative num.

Added to usb queue.

thanks,
Gerd