Commit 1744020c authored by Sven Schnelle's avatar Sven Schnelle Committed by Greg Kroah-Hartman

USB: dbgp gadget: fix return value of dbgp_setup

Current code returns 0 even if it can't handle the request.
This leads to timeouts when an unhandled request is sent:

Bus 001 Device 003: ID 0525:c0de Netchip Technology, Inc.
Device Descriptor:
[..]
can't get device qualifier: Connection timed out
[..]

change the code to return EOPNOTSUPP in such cases.
Signed-off-by: default avatarSven Schnelle <svens@stackframe.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 25a73c6c
...@@ -350,9 +350,9 @@ static int dbgp_setup(struct usb_gadget *gadget, ...@@ -350,9 +350,9 @@ static int dbgp_setup(struct usb_gadget *gadget,
u8 request = ctrl->bRequest; u8 request = ctrl->bRequest;
u16 value = le16_to_cpu(ctrl->wValue); u16 value = le16_to_cpu(ctrl->wValue);
u16 length = le16_to_cpu(ctrl->wLength); u16 length = le16_to_cpu(ctrl->wLength);
int err = 0; int err = -EOPNOTSUPP;
void *data; void *data = NULL;
u16 len; u16 len = 0;
gadget->ep0->driver_data = gadget; gadget->ep0->driver_data = gadget;
...@@ -371,10 +371,9 @@ static int dbgp_setup(struct usb_gadget *gadget, ...@@ -371,10 +371,9 @@ static int dbgp_setup(struct usb_gadget *gadget,
default: default:
goto fail; goto fail;
} }
err = 0;
} else if (request == USB_REQ_SET_FEATURE && } else if (request == USB_REQ_SET_FEATURE &&
value == USB_DEVICE_DEBUG_MODE) { value == USB_DEVICE_DEBUG_MODE) {
len = 0;
data = NULL;
dev_dbg(&dbgp.gadget->dev, "setup: feat debug\n"); dev_dbg(&dbgp.gadget->dev, "setup: feat debug\n");
#ifdef CONFIG_USB_G_DBGP_PRINTK #ifdef CONFIG_USB_G_DBGP_PRINTK
err = dbgp_enable_ep(); err = dbgp_enable_ep();
......
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