Fix example/CO_storageLinux.c.
CO_LOCK_OD(CANmodule) must not be used, because lock is already applied by SDO server.
This commit is contained in:
parent
059c6b5038
commit
ef12016a55
2 changed files with 4 additions and 3 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 05931a6b763299cc1bff2eb8c6926f086bc55131
|
Subproject commit 29c5b64131654b6f6f2171c64a1d5ce8031bcaa0
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
*/
|
*/
|
||||||
static ODR_t
|
static ODR_t
|
||||||
storeLinux(CO_storage_entry_t* entry, CO_CANmodule_t* CANmodule) {
|
storeLinux(CO_storage_entry_t* entry, CO_CANmodule_t* CANmodule) {
|
||||||
|
(void)CANmodule;
|
||||||
ODR_t ret = ODR_OK;
|
ODR_t ret = ODR_OK;
|
||||||
uint16_t crc_store;
|
uint16_t crc_store;
|
||||||
|
|
||||||
|
|
@ -61,10 +62,10 @@ storeLinux(CO_storage_entry_t* entry, CO_CANmodule_t* CANmodule) {
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
ret = ODR_HW;
|
ret = ODR_HW;
|
||||||
} else {
|
} else {
|
||||||
CO_LOCK_OD(CANmodule);
|
/* following two lines are subject to race conditions. This function is called only by SDO server
|
||||||
|
* and so it is already protected by CO_LOCK_OD. */
|
||||||
size_t cnt = fwrite(entry->addr, 1, entry->len, fp);
|
size_t cnt = fwrite(entry->addr, 1, entry->len, fp);
|
||||||
crc_store = crc16_ccitt(entry->addr, entry->len, 0);
|
crc_store = crc16_ccitt(entry->addr, entry->len, 0);
|
||||||
CO_UNLOCK_OD(CANmodule);
|
|
||||||
cnt += fwrite(&crc_store, 1, sizeof(crc_store), fp);
|
cnt += fwrite(&crc_store, 1, sizeof(crc_store), fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (cnt != (entry->len + sizeof(crc_store))) {
|
if (cnt != (entry->len + sizeof(crc_store))) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue