diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-02-22 15:12:40 (GMT) |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2017-04-14 14:44:16 (GMT) |
commit | 842778a091047b0c868efa12229633959f711152 (patch) | |
tree | 7e24aa66ed0bbd2189c4281966d69a590125a451 /drivers/usb | |
parent | 12d0b8f5f07b76d7447d60f7528d578233553909 (diff) | |
download | u-boot-842778a091047b0c868efa12229633959f711152.tar.xz |
usb: gadget: g_dnl: only set iSerialNumber if we have a serial#
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/g_dnl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index fcedb55..4cc4438 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); |