usb: usb_dc_kinetis: Fix setting address for not attached device

Add appropriate check.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This commit is contained in:
Andrei Emeltchenko 2019-03-22 17:16:33 +02:00 committed by Anas Nashif
commit 08f53a435c

View file

@ -256,6 +256,11 @@ int usb_dc_detach(void)
int usb_dc_set_address(const u8_t addr)
{
LOG_DBG("");
if (!dev_data.attached) {
return -EINVAL;
}
/*
* The device stack tries to set the address before
* sending the ACK with ZLP, which is totally stupid,