From: <woojung....@microchip.com> Date: Mon, 27 Jul 2015 19:59:30 +0000
> +static int lan78xx_read_stats(struct lan78xx_net *dev, > + struct lan78xx_statstage *data) > +{ > + int ret = 0; > + struct lan78xx_statstage *stats; > + > + BUG_ON(!dev); > + BUG_ON(!data); > + BUG_ON(sizeof(struct lan78xx_statstage) != 0xBC); > + > + stats = kmalloc(sizeof(*stats), GFP_KERNEL); > + if (!stats) > + return -ENOMEM; > + > + ret = usb_control_msg(dev->udev, > + usb_rcvctrlpipe(dev->udev, 0), > + USB_VENDOR_REQUEST_GET_STATS, > + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, > + 0, > + 0, > + (void *)stats, > + sizeof(*stats), > + USB_CTRL_SET_TIMEOUT); > + if (likely(ret >= 0)) { > + le32_to_cpus(stats); > + *data = *stats; This doesn't work. le32_to_cpus() will only byte swap the first 'u32' in this statistics structure, not all of them. You have to explicitly byte swap each and every member. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html