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:
parent
e17d57ecab
commit
dc83d35da3
|
@ -142,9 +142,6 @@ static int setup_ep0(struct usbdev_ctrl *this, dev_req_t *dr)
|
||||||
struct usbdev_configuration *config =
|
struct usbdev_configuration *config =
|
||||||
fetch_config(this, dr->wValue);
|
fetch_config(this, dr->wValue);
|
||||||
|
|
||||||
this->current_config = config;
|
|
||||||
this->current_config_id = dr->wValue;
|
|
||||||
|
|
||||||
if (dr->wValue == 0)
|
if (dr->wValue == 0)
|
||||||
cease_operation(this);
|
cease_operation(this);
|
||||||
|
|
||||||
|
@ -157,7 +154,10 @@ static int setup_ep0(struct usbdev_ctrl *this, dev_req_t *dr)
|
||||||
/* status phase IN */
|
/* status phase IN */
|
||||||
this->enqueue_packet(this, 0, 1, NULL, 0, 0, 0);
|
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);
|
enable_interface(this, 0);
|
||||||
this->initialized = 1;
|
this->initialized = 1;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue