Invalidate processing register requests when clearing configuration.
--- a/master/fsm_slave.c Tue Dec 04 12:22:38 2012 +0100
+++ b/master/fsm_slave.c Tue Dec 04 12:23:43 2012 +0100
@@ -336,6 +336,12 @@
ec_slave_t *slave = fsm->slave;
ec_reg_request_t *reg = fsm->reg_request;
+ if (!reg) {
+ // configuration was cleared in the meantime
+ fsm->state = ec_fsm_slave_state_ready;
+ return;
+ }
+
if (fsm->datagram->state != EC_DATAGRAM_RECEIVED) {
EC_SLAVE_ERR(slave, "Failed to receive register"
" request datagram: ");
--- a/master/slave_config.c Tue Dec 04 12:22:38 2012 +0100
+++ b/master/slave_config.c Tue Dec 04 12:23:43 2012 +0100
@@ -268,7 +268,18 @@
)
{
if (sc->slave) {
+ ec_reg_request_t *reg;
+
sc->slave->config = NULL;
+
+ // invalidate processing register request
+ list_for_each_entry(reg, &sc->reg_requests, list) {
+ if (sc->slave->fsm.reg_request == reg) {
+ sc->slave->fsm.reg_request = NULL;
+ break;
+ }
+ }
+
sc->slave = NULL;
}
}