]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
usb: gadget: g_dnl: only set iSerialNumber if we have a serial#
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 22 Feb 2017 15:12:40 +0000 (17:12 +0200)
committerMarek Vasut <marex@denx.de>
Fri, 14 Apr 2017 14:44:16 +0000 (16:44 +0200)
We don't want to claim that we support a serial number string and
later return nothing. Because of that, if g_dnl_serial is an empty
string, let's skip setting iSerialNumber to a valid number.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/g_dnl.c

index fcedb554c4c6bbc1c3009a3b0f17e72188356c04..4cc4438fdb4aff09f933a83e59e911e4346f2a6a 100644 (file)
@@ -224,12 +224,14 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
        g_dnl_string_defs[1].id = id;
        device_desc.iProduct = id;
 
-       id = usb_string_id(cdev);
-       if (id < 0)
-               return id;
+       if (strlen(g_dnl_serial)) {
+               id = usb_string_id(cdev);
+               if (id < 0)
+                       return id;
 
-       g_dnl_string_defs[2].id = id;
-       device_desc.iSerialNumber = id;
+               g_dnl_string_defs[2].id = id;
+               device_desc.iSerialNumber = id;
+       }
 
        g_dnl_bind_fixup(&device_desc, cdev->driver->name);
        ret = g_dnl_config_register(cdev);