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 <>
Cc: Fabio Estevam <>
Cc: Lei Wen <>
Cc: Otavio Salvador <>
Cc: Stefano Babic <>
parent be7ed253
......@@ -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)
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