diff -r 5ef6507fc77a -r 2bd8ad8bf41f master/fsm_master.c --- a/master/fsm_master.c Wed Jan 05 09:50:35 2011 +0100 +++ b/master/fsm_master.c Wed Jan 05 11:33:31 2011 +0100 @@ -1068,6 +1068,7 @@ if (!ec_fsm_sii_success(&fsm->fsm_sii)) { EC_SLAVE_ERR(slave, "Failed to write SII data.\n"); request->state = EC_INT_REQUEST_FAILURE; + kref_put(&request->refcount,ec_master_sii_write_request_release); wake_up(&master->sii_queue); ec_fsm_master_restart(fsm); return; @@ -1096,6 +1097,7 @@ // TODO: Evaluate other SII contents! request->state = EC_INT_REQUEST_SUCCESS; + kref_put(&request->refcount,ec_master_sii_write_request_release); wake_up(&master->sii_queue); // check for another SII write request @@ -1228,6 +1230,19 @@ /*****************************************************************************/ +/** called by kref_put if the SII write request's refcount becomes zero. + * + */ +void ec_master_sii_write_request_release(struct kref *ref) +{ + ec_sii_write_request_t *request = container_of(ref, ec_sii_write_request_t, refcount); + EC_SLAVE_DBG(request->slave, 1, "Releasing SII write request %p.\n",request); + kfree(request->words); + kfree(request); +} + +/*****************************************************************************/ + /** called by kref_put if the SDO request's refcount becomes zero. * */