summaryrefslogtreecommitdiff
path: root/chip/stm32/usb.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2014-12-01 13:36:42 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-02 21:11:35 +0000
commit0f10bf88b27746d6f757538a11d9f7d6ca334e8d (patch)
tree2240ddc0767e1ed6750773655456351f797fd116 /chip/stm32/usb.c
parent8fa4947f7681aac58937395610ed204fa34b6d5a (diff)
downloadchrome-ec-0f10bf88b27746d6f757538a11d9f7d6ca334e8d.tar.gz
USB: Interface callbacks now return an error code
A non-zero error code returned by the callback causes EP0 to STALL. This is the common mechanism used in USB to indicate an error while processing a control request. This simplifies the implementation of interface callbacks. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I89ceb4892f9f810fcaf6e975e6982fc5b2ae447b Reviewed-on: https://chromium-review.googlesource.com/232368 Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/usb.c')
-rw-r--r--chip/stm32/usb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index b4dfb31fb5..64bff8bd40 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -94,8 +94,9 @@ static void ep0_rx(void)
/* interface specific requests */
if ((req & USB_RECIP_MASK) == USB_RECIP_INTERFACE) {
uint8_t iface = ep0_buf_rx[2] & 0xff;
- if (iface < USB_IFACE_COUNT)
- usb_iface_request[iface](ep0_buf_rx, ep0_buf_tx);
+ if (iface < USB_IFACE_COUNT &&
+ usb_iface_request[iface](ep0_buf_rx, ep0_buf_tx))
+ goto unknown_req;
return;
}