Commit d7663038 authored by Marek Vasut's avatar Marek Vasut
Browse files

usb: mv_udc: Clean up the initial variable check



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: default avatarMarek 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>
parent be7ed253
...@@ -471,13 +471,12 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) ...@@ -471,13 +471,12 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
struct mv_udc *udc; struct mv_udc *udc;
int ret; int ret;
if (!driver if (!driver)
|| driver->speed < USB_SPEED_FULL return -EINVAL;
|| !driver->bind if (!driver->bind || !driver->setup || !driver->disconnect)
|| !driver->setup) { return -EINVAL;
DBG("bad parameter.\n"); if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH)
return -EINVAL; return -EINVAL;
}
ret = usb_lowlevel_init(0, (void **)&controller.ctrl); ret = usb_lowlevel_init(0, (void **)&controller.ctrl);
if (ret) if (ret)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment