]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/gadget/composite.c
usb: gadget: composite: fix NULL pointer when a non standard request is received
[u-boot] / drivers / usb / gadget / composite.c
index d0ee7847b98dbb98dd2e220e741009a3a107ba5b..a87639def97433366e1b6218169c55f6ef6ba43b 100644 (file)
@@ -838,6 +838,9 @@ unknown:
                        ctrl->bRequestType, ctrl->bRequest,
                        w_value, w_index, w_length);
 
+               if (!cdev->config)
+                       goto done;
+
                /*
                 * functions always handle their interfaces and endpoints...
                 * punt other recipients (other, WUSB, ...) to the current
@@ -882,7 +885,7 @@ unknown:
                        value = f->setup(f, ctrl);
                else {
                        c = cdev->config;
-                       if (c && c->setup)
+                       if (c->setup)
                                value = c->setup(c, ctrl);
                }