usb: handle NULL table in usb_gadget_get_string
Allow a NULL table to be passed to usb_gadget_get_string for cases when a string table may not be populated. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Tom Rini <trini@ti.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
This commit is contained in:
		
							parent
							
								
									fd2a89b20b
								
							
						
					
					
						commit
						52d45012ff
					
				|  | @ -108,6 +108,9 @@ usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf) | ||||||
| 	struct usb_string	*s; | 	struct usb_string	*s; | ||||||
| 	int			len; | 	int			len; | ||||||
| 
 | 
 | ||||||
|  | 	if (!table) | ||||||
|  | 		return -EINVAL; | ||||||
|  | 
 | ||||||
| 	/* descriptor 0 has the language id */ | 	/* descriptor 0 has the language id */ | ||||||
| 	if (id == 0) { | 	if (id == 0) { | ||||||
| 		buf[0] = 4; | 		buf[0] = 4; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue