1
0
Fork 0

CO_storage: static analysis: body should be a compound statement [MISRA 2012 Rule 15.6, required]

This commit is contained in:
temi54c1l8 2024-06-13 14:55:36 +02:00
parent d64f0dcc41
commit d0718824f2
2 changed files with 27 additions and 10 deletions

View file

@ -60,19 +60,26 @@ static ODR_t OD_write_1010(OD_stream_t *stream, const void *buf,
CO_storage_entry_t *entry = &storage->entries[i];
if ((stream->subIndex == 1U) || (entry->subIndexOD == stream->subIndex)) {
if (found == 0U) found = 1;
if (found == 0U) {
found = 1;
}
if ((entry->attr & (uint8_t)CO_storage_cmd) != 0U) {
ODR_t code = storage->store(entry, storage->CANmodule);
if (code != ODR_OK) returnCode = code;
if (code != ODR_OK) {
returnCode = code;
}
found = 2;
}
}
}
if (found != 2U)
if (found != 2U) {
returnCode = (found == 0U) ? ODR_SUB_NOT_EXIST : ODR_READONLY;
}
if (returnCode == ODR_OK) *countWritten = sizeof(uint32_t);
if (returnCode == ODR_OK) {
*countWritten = sizeof(uint32_t);
}
return returnCode;
}
@ -111,19 +118,26 @@ static ODR_t OD_write_1011(OD_stream_t *stream, const void *buf,
CO_storage_entry_t *entry = &storage->entries[i];
if ((stream->subIndex == 1U) || (entry->subIndexOD == stream->subIndex)) {
if (found == 0U) found = 1;
if (found == 0U) {
found = 1;
}
if ((entry->attr & (uint8_t)CO_storage_restore) != 0U) {
ODR_t code = storage->restore(entry, storage->CANmodule);
if (code != ODR_OK) returnCode = code;
if (code != ODR_OK) {
returnCode = code;
}
found = 2;
}
}
}
if (found != 2U)
if (found != 2U) {
returnCode = (found == 0U) ? ODR_SUB_NOT_EXIST : ODR_READONLY;
}
if (returnCode == ODR_OK) *countWritten = sizeof(uint32_t);
if (returnCode == ODR_OK) {
*countWritten = sizeof(uint32_t);
}
return returnCode;
}

View file

@ -211,7 +211,9 @@ CO_ReturnError_t CO_storageEeprom_init(CO_storage_t *storage,
/* additional info in case of error */
if (dataCorrupt) {
uint32_t errorBit = entry->subIndexOD;
if (errorBit > 31U) errorBit = 31;
if (errorBit > 31U) {
errorBit = 31;
}
*storageInitError |= ((uint32_t) 1) << errorBit;
ret = CO_ERROR_DATA_CORRUPT;
}
@ -233,8 +235,9 @@ void CO_storageEeprom_auto_process(CO_storage_t *storage, bool_t saveAll) {
for (uint8_t i = 0; i < storage->entriesCount; i++) {
CO_storage_entry_t *entry = &storage->entries[i];
if ((entry->attr & (uint8_t)CO_storage_auto) == 0U)
if ((entry->attr & (uint8_t)CO_storage_auto) == 0U) {
continue;
}
if (saveAll) {
/* update all bytes */