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.ba...@linux.intel.com>
---

No access to a board right now, compile tested only

 drivers/usb/gadget/g_dnl.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index fcedb554c4c6..4cc4438fdb4a 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -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);
-- 
2.11.0.295.gd7dffce1ce

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to