summaryrefslogtreecommitdiff
path: root/drivers/staging/usbip/userspace
diff options
context:
space:
mode:
authorValentina Manea <valentina.manea.m@gmail.com>2014-03-08 12:53:35 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-03-09 06:50:24 (GMT)
commit87f627f7bd87d077d04a3549b311c6f9a204aaaf (patch)
tree23cb741ef44688dd6e86552d5195673f26cbb702 /drivers/staging/usbip/userspace
parent6080cd0e9239469524d2aa07250ad4b9f383960d (diff)
downloadlinux-87f627f7bd87d077d04a3549b311c6f9a204aaaf.tar.xz
staging: usbip: userspace: don't throw error when trying to read configuration specific attributes
When a device has just been bound to usbip-host but the client hasn't set a configuration on it, certain attributes will not exist. Don't treat this as an error. Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/usbip/userspace')
-rw-r--r--drivers/staging/usbip/userspace/libsrc/usbip_common.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/staging/usbip/userspace/libsrc/usbip_common.c b/drivers/staging/usbip/userspace/libsrc/usbip_common.c
index 998c11c..238bf5b 100644
--- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c
+++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c
@@ -127,10 +127,23 @@ int read_attr_value(struct udev_device *dev, const char *name,
goto err;
}
+ /* The client chooses the device configuration
+ * when attaching it so right after being bound
+ * to usbip-host on the server the device will
+ * have no configuration.
+ * Therefore, attributes such as bConfigurationValue
+ * and bNumInterfaces will not exist and sscanf will
+ * fail. Check for these cases and don't treat them
+ * as errors.
+ */
+
ret = sscanf(attr, format, &num);
if (ret < 1) {
- err("sscanf failed");
- goto err;
+ if (strcmp(name, "bConfigurationValue") &&
+ strcmp(name, "bNumInterfaces")) {
+ err("sscanf failed for attribute %s", name);
+ goto err;
+ }
}
err: