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>
This commit is contained in:
		
							parent
							
								
									12d0b8f5f0
								
							
						
					
					
						commit
						842778a091
					
				|  | @ -224,12 +224,14 @@ static int g_dnl_bind(struct usb_composite_dev *cdev) | ||||||
| 	g_dnl_string_defs[1].id = id; | 	g_dnl_string_defs[1].id = id; | ||||||
| 	device_desc.iProduct = id; | 	device_desc.iProduct = id; | ||||||
| 
 | 
 | ||||||
|  | 	if (strlen(g_dnl_serial)) { | ||||||
| 		id = usb_string_id(cdev); | 		id = usb_string_id(cdev); | ||||||
| 		if (id < 0) | 		if (id < 0) | ||||||
| 			return id; | 			return id; | ||||||
| 
 | 
 | ||||||
| 		g_dnl_string_defs[2].id = id; | 		g_dnl_string_defs[2].id = id; | ||||||
| 		device_desc.iSerialNumber = id; | 		device_desc.iSerialNumber = id; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	g_dnl_bind_fixup(&device_desc, cdev->driver->name); | 	g_dnl_bind_fixup(&device_desc, cdev->driver->name); | ||||||
| 	ret = g_dnl_config_register(cdev); | 	ret = g_dnl_config_register(cdev); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue