From: Rob Herring Date: Fri, 18 Apr 2014 13:54:28 +0000 (-0500) Subject: usb: handle NULL table in usb_gadget_get_string X-Git-Tag: v2014.07-rc1~8^2~19 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=52d45012ff66dee716b8dfcb7d67d3ab54a3208a;p=u-boot 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 Reviewed-by: Tom Rini Acked-by: Marek Vasut Acked-by: Lukasz Majewski --- diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c index de5fa3f648..8c3ff64fe3 100644 --- a/drivers/usb/gadget/usbstring.c +++ b/drivers/usb/gadget/usbstring.c @@ -108,6 +108,9 @@ usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf) struct usb_string *s; int len; + if (!table) + return -EINVAL; + /* descriptor 0 has the language id */ if (id == 0) { buf[0] = 4;