+ Shuah Khan On 03/23/2017 03:46 AM, Yuyang Du wrote:
parse_status() reads the status file one by one, so it can only update the available and according vhci_driver->idev's. Signed-off-by: Yuyang Du <yuyang.du@xxxxxxxxx> --- tools/usb/usbip/libsrc/vhci_driver.c | 34 ++++++++++++++-------------------- tools/usb/usbip/src/usbip_attach.c | 2 ++ 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c index 1c0e7f0..5b14235 100644 --- a/tools/usb/usbip/libsrc/vhci_driver.c +++ b/tools/usb/usbip/libsrc/vhci_driver.c @@ -40,10 +40,6 @@ static int parse_status(const char *value) int ret = 0; char *c; - for (int i = 0; i < vhci_driver->nports; i++) - memset(&vhci_driver->idev[i], 0, sizeof(vhci_driver->idev[i])); - - /* skip a header line */ c = strchr(value, '\n'); if (!c) @@ -68,30 +64,28 @@ static int parse_status(const char *value) port, status, speed, devid); dbg("socket %lx lbusid %s", socket, lbusid); - /* if a device is connected, look at it */ - { - struct usbip_imported_device *idev = &vhci_driver->idev[port]; + struct usbip_imported_device *idev = &vhci_driver->idev[port]; - idev->port = port; - idev->status = status; + memset(&vhci_driver->idev[port], 0, sizeof(struct usbip_imported_device));
maybe just: memset(idev, 0, sizeof(*idev)); Best regards, -- Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html