summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-04-18 08:54:28 -0500
committerMarek Vasut <marex@denx.de>2014-04-30 10:30:57 +0200
commit52d45012ff66dee716b8dfcb7d67d3ab54a3208a (patch)
tree4c7a731a6e3eaf6321c0cae7846217fac04b54ea /drivers
parentfd2a89b20ba66d76929f672b03f392733fb1b2a6 (diff)
downloadu-boot-imx-52d45012ff66dee716b8dfcb7d67d3ab54a3208a.zip
u-boot-imx-52d45012ff66dee716b8dfcb7d67d3ab54a3208a.tar.gz
u-boot-imx-52d45012ff66dee716b8dfcb7d67d3ab54a3208a.tar.bz2
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/usbstring.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
index de5fa3f..8c3ff64 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;