@@ -18,7 +18,7 @@
#ifdef DEBUG
#define dprintf(_x ...) do { printf(_x); } while(0)
#else
-#define dprintf(_x ...)
+#define dprintf(_x ...) do {} while (0)
#endif
#define __unused __attribute__((unused))
@@ -386,7 +386,7 @@ int usb_hid_exit(void *vdev)
int usb_msc_init(void *vdev)
{
struct usb_dev *dev;
- int i;
+ unsigned i;
dev = (struct usb_dev *) vdev;
dprintf("%s: enter %x\n", __func__, dev->class);
@@ -390,7 +390,7 @@ uint32_t *kbd_buffer;
int usb_hid_kbd_init(struct usb_dev *dev)
{
- int i;
+ unsigned i;
uint8_t key[8];
usb_hid_set_protocol(dev, 0);
@@ -21,7 +21,7 @@
#ifdef OHCI_DEBUG
#define dprintf(_x ...) do { printf(_x); } while(0)
#else
-#define dprintf(_x ...)
+#define dprintf(_x ...) do {} while (0)
#endif
#undef OHCI_DEBUG_PACKET
@@ -29,7 +29,7 @@
#ifdef OHCI_DEBUG_PACKET
#define dpprintf(_x ...) do { printf(_x); } while(0)
#else
-#define dpprintf(_x ...)
+#define dpprintf(_x ...) do {} while (0)
#endif
@@ -199,10 +199,7 @@ static void ohci_hub_check_ports(struct ohci_hcd *ohcd)
}
if (port_status & RH_PS_PESC) {
port_clear |= RH_PS_PESC;
- if (port_status & RH_PS_PES)
- dprintf("enabled\n");
- else
- dprintf("disabled\n");
+ dprintf((port_status & RH_PS_PES) ? "enabled\n" : "disabled\n");
}
if (port_status & RH_PS_PSSC) {
port_clear |= RH_PS_PESC;
@@ -927,9 +924,10 @@ static struct usb_pipe *ohci_get_pipe(struct usb_dev *dev, struct usb_ep_descr *
new->epno = ep->bEndpointAddress & 0xF;
new->dir = ep->bEndpointAddress & 0x80;
if (new->type == USB_EP_TYPE_INTR)
- if (!ohci_get_pipe_intr(new, ohcd, buf, buflen))
+ if (!ohci_get_pipe_intr(new, ohcd, buf, buflen)) {
dprintf("usb-ohci: %s alloc_intr failed %p\n",
__func__, new);
+ }
if (new->type == USB_EP_TYPE_BULK)
ohci_init_bulk_ed(dev, new);
@@ -1157,7 +1157,7 @@ static inline struct xhci_seg *xhci_pipe_get_seg(struct usb_pipe *pipe)
static inline void *xhci_get_trb(struct xhci_seg *seg)
{
uint64_t val, enq;
- int index;
+ unsigned index;
struct xhci_link_trb *link;
enq = val = seg->enq;
@@ -1185,7 +1185,7 @@ static inline void *xhci_get_trb(struct xhci_seg *seg)
static inline void *xhci_get_trb_deq(struct xhci_seg *seg)
{
uint64_t deq_next, deq;
- int index;
+ unsigned index;
deq = seg->deq;
deq_next = deq + XHCI_TRB_SIZE;
-Wextra enables a bunch of rather useful checks which this fixes. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- lib/libusb/usb-core.c | 4 ++-- lib/libusb/usb-hid.c | 2 +- lib/libusb/usb-ohci.c | 12 +++++------- lib/libusb/usb-xhci.c | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-)