]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: mv_udc: Clean up the initial variable check
authorMarek Vasut <marex@denx.de>
Wed, 10 Jul 2013 01:16:33 +0000 (03:16 +0200)
committerMarek Vasut <marex@denx.de>
Mon, 29 Jul 2013 21:01:31 +0000 (23:01 +0200)
Clean up the code that checks the validity of a USB gadget driver
in usb_gadget_register_driver(). Moreover, limit the speed of the
driver to either FULL or HIGH, this is more precise and once we
have xHCI support, also more correct.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Lei Wen <leiwen@marvell.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Stefano Babic <sbabic@denx.de>
drivers/usb/gadget/mv_udc.c

index 6d69d6d568c5b28deb2d244f0cb442f3e17420f4..bed589820a049f238b139c9fcbd52313b90dcdda 100644 (file)
@@ -471,13 +471,12 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
        struct mv_udc *udc;
        int ret;
 
-       if (!driver
-                       || driver->speed < USB_SPEED_FULL
-                       || !driver->bind
-                       || !driver->setup) {
-               DBG("bad parameter.\n");
+       if (!driver)
+               return -EINVAL;
+       if (!driver->bind || !driver->setup || !driver->disconnect)
+               return -EINVAL;
+       if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH)
                return -EINVAL;
-       }
 
        ret = usb_lowlevel_init(0, (void **)&controller.ctrl);
        if (ret)