]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
usb: handle NULL table in usb_gadget_get_string
authorRob Herring <robh@kernel.org>
Fri, 18 Apr 2014 13:54:28 +0000 (08:54 -0500)
committerMarek Vasut <marex@denx.de>
Wed, 30 Apr 2014 08:30:57 +0000 (10:30 +0200)
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>
drivers/usb/gadget/usbstring.c

index de5fa3f6483f3e5529b01cceb599146aa7c07b16..8c3ff64fe35359566a673a08791228d4f95989cf 100644 (file)
@@ -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;