From dc83d35da37e62e7b8c699013f870ebc883766b6 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Tue, 10 Mar 2015 12:57:11 +0100 Subject: libpayload udc: Only enable configuration if it's valid Only set internal variables when there's no risk of breaking things. BRANCH=none BUG=none TEST=none Change-Id: I8a8b63f60bdb70fad38130ce38eef81fe3725aa2 Signed-off-by: Patrick Georgi Original-Commit-Id: 7119829096b444b790937b116fb782bcb5da70cd Original-Change-Id: If698b11a7ff7688def310d8574fcfa7a40f703c1 Original-Signed-off-by: Patrick Georgi Original-Reviewed-on: https://chromium-review.googlesource.com/258063 Original-Reviewed-by: Furquan Shaikh Reviewed-on: http://review.coreboot.org/9789 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/drivers/udc/udc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'payloads') diff --git a/payloads/libpayload/drivers/udc/udc.c b/payloads/libpayload/drivers/udc/udc.c index 9694ff8ec1..23c319bbe4 100644 --- a/payloads/libpayload/drivers/udc/udc.c +++ b/payloads/libpayload/drivers/udc/udc.c @@ -142,9 +142,6 @@ static int setup_ep0(struct usbdev_ctrl *this, dev_req_t *dr) struct usbdev_configuration *config = fetch_config(this, dr->wValue); - this->current_config = config; - this->current_config_id = dr->wValue; - if (dr->wValue == 0) cease_operation(this); @@ -157,7 +154,10 @@ static int setup_ep0(struct usbdev_ctrl *this, dev_req_t *dr) /* status phase IN */ this->enqueue_packet(this, 0, 1, NULL, 0, 0, 0); - /* automatically configure endpoints in interface 0 */ + this->current_config = config; + this->current_config_id = dr->wValue; + + /* activate first interface */ enable_interface(this, 0); this->initialized = 1; return 1; -- cgit v1.2.3