1
0
Fork 0

CO_SYNC: static analysis: dependence placed on operator precedence [MISRA 2012 Rule 12.1, advisory]

This commit is contained in:
temi54c1l8 2024-06-27 12:53:30 +02:00
parent f684b34a03
commit d6b3163311

View file

@ -96,8 +96,8 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
/* verify written value */
#if ((CO_CONFIG_SYNC) & CO_CONFIG_SYNC_PRODUCER) != 0
bool_t isProducer = (cobIdSync & 0x40000000) != 0;
if ((cobIdSync & 0xBFFFF800) != 0 || CO_IS_RESTRICTED_CAN_ID(CAN_ID)
|| (SYNC->isProducer && isProducer && CAN_ID != SYNC->CAN_ID)
if (((cobIdSync & 0xBFFFF800) != 0) || CO_IS_RESTRICTED_CAN_ID(CAN_ID)
|| (SYNC->isProducer && isProducer && (CAN_ID != SYNC->CAN_ID))
) {
return ODR_INVALID_VALUE;
}
@ -128,7 +128,7 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
SYNC->CANdevTxIdx, /* index of specific buffer inside CAN module */
CAN_ID, /* CAN identifier */
false, /* rtr */
SYNC->counterOverflowValue != 0 ? 1 : 0, /* number of data bytes */
(SYNC->counterOverflowValue != 0) ? 1 : 0, /* number of data bytes */
false); /* synchronous message flag bit */
if (SYNC->CANtxBuff == NULL) {
@ -161,8 +161,8 @@ static ODR_t OD_write_1005(OD_stream_t *stream, const void *buf,
static ODR_t OD_write_1019(OD_stream_t *stream, const void *buf,
OD_size_t count, OD_size_t *countWritten)
{
if (stream == NULL || stream->subIndex != 0 || buf == NULL
|| count != sizeof(uint8_t) || countWritten == NULL
if ((stream == NULL) || (stream->subIndex != 0) || (buf == NULL)
|| (count != sizeof(uint8_t)) || (countWritten == NULL)
) {
return ODR_DEV_INCOMPAT;
}
@ -171,7 +171,7 @@ static ODR_t OD_write_1019(OD_stream_t *stream, const void *buf,
uint8_t syncCounterOvf = CO_getUint8(buf);
/* verify written value */
if (syncCounterOvf == 1 || syncCounterOvf > 240) {
if ((syncCounterOvf == 1) || (syncCounterOvf > 240)) {
return ODR_INVALID_VALUE;
}
if (*SYNC->OD_1006_period != 0) {
@ -184,7 +184,7 @@ static ODR_t OD_write_1019(OD_stream_t *stream, const void *buf,
SYNC->CANdevTxIdx, /* index of specific buffer inside CAN module */
SYNC->CAN_ID, /* CAN identifier */
false, /* rtr */
syncCounterOvf != 0 ? 1 : 0, /* number of data bytes */
(syncCounterOvf != 0) ? 1 : 0, /* number of data bytes */
false); /* synchronous message flag bit */
if (SYNC->CANtxBuff == NULL) {
@ -336,7 +336,7 @@ CO_ReturnError_t CO_SYNC_init(CO_SYNC_t *SYNC,
CANdevTxIdx, /* index of specific buffer inside CAN module */
cobIdSync & 0x7FF, /* CAN identifier */
false, /* rtr */
syncCounterOvf != 0 ? 1 : 0, /* number of data bytes */
(syncCounterOvf != 0) ? 1 : 0, /* number of data bytes */
false); /* synchronous message flag bit */
if (SYNC->CANtxBuff == NULL) {