use status variable instead of explicit gotos to distinguish between a repsonse and stall condition. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- drivers/usb/gadget/f_hid.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c index 32cef14..98d5a7a 100644 --- a/drivers/usb/gadget/f_hid.c +++ b/drivers/usb/gadget/f_hid.c @@ -341,14 +341,12 @@ static int hidg_setup(struct usb_function *f, /* send an empty report */ length = min_t(unsigned, length, hidg->report_length); memset(req->buf, 0x0, length); - - goto respond; break; case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 | HID_REQ_GET_PROTOCOL): VDBG(cdev, "get_protocol\n"); - goto stall; + status = -EOPNOTSUPP; break; case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 @@ -356,13 +354,12 @@ static int hidg_setup(struct usb_function *f, VDBG(cdev, "set_report | wLenght=%d\n", ctrl->wLength); req->context = hidg; req->complete = hidg_set_report_complete; - goto respond; break; case ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8 | HID_REQ_SET_PROTOCOL): VDBG(cdev, "set_protocol\n"); - goto stall; + status = -EOPNOTSUPP; break; case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8 @@ -373,20 +370,18 @@ static int hidg_setup(struct usb_function *f, length = min_t(unsigned short, length, hidg_desc.bLength); memcpy(req->buf, &hidg_desc, length); - goto respond; break; case HID_DT_REPORT: VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n"); length = min_t(unsigned short, length, hidg->report_desc_length); memcpy(req->buf, hidg->report_desc, length); - goto respond; break; default: VDBG(cdev, "Unknown decriptor request 0x%x\n", value >> 8); - goto stall; + status = -EOPNOTSUPP; break; } break; @@ -394,14 +389,13 @@ static int hidg_setup(struct usb_function *f, default: VDBG(cdev, "Unknown request 0x%x\n", ctrl->bRequest); - goto stall; + status = -EOPNOTSUPP; break; } -stall: - return -EOPNOTSUPP; + if (status) + return status; -respond: req->zero = 0; req->length = length; status = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC); -- 1.7.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html