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 <pgeorgi@chromium.org>
Original-Commit-Id: 7119829096b444b790937b116fb782bcb5da70cd
Original-Change-Id: If698b11a7ff7688def310d8574fcfa7a40f703c1
Original-Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/258063
Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9789
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Patrick Georgi 2015-03-10 12:57:11 +01:00
parent e17d57ecab
commit dc83d35da3
1 changed files with 4 additions and 4 deletions

View File

@ -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;