aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/hal_serial_usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/src/hal_serial_usb.c')
-rw-r--r--os/hal/src/hal_serial_usb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/os/hal/src/hal_serial_usb.c b/os/hal/src/hal_serial_usb.c
index adf5856c4..7d4ed05a8 100644
--- a/os/hal/src/hal_serial_usb.c
+++ b/os/hal/src/hal_serial_usb.c
@@ -264,6 +264,7 @@ void sduStop(SerialUSBDriver *sdup) {
osalDbgCheck(sdup != NULL);
osalSysLock();
+
osalDbgAssert((sdup->state == SDU_STOP) || (sdup->state == SDU_READY),
"invalid state");
@@ -273,11 +274,13 @@ void sduStop(SerialUSBDriver *sdup) {
if (sdup->config->int_in > 0U) {
usbp->in_params[sdup->config->int_in - 1U] = NULL;
}
- sdup->state = SDU_STOP;
+ sdup->config = NULL;
+ sdup->state = SDU_STOP;
/* Enforces a disconnection.*/
sduDisconnectI(sdup);
osalOsRescheduleS();
+
osalSysUnlock();
}