Fixed some warnings flagged by IAR C-STAT static analysis tool.

This commit is contained in:
skarg
2016-01-07 21:31:38 +00:00
parent dd0fb9c841
commit 0697065030
16 changed files with 51 additions and 52 deletions
+1 -1
View File
@@ -215,7 +215,7 @@ uint8_t automac_free_address_random(
count = automac_free_address_count();
if (count) {
random_count = rand() % count;
random_count =(uint8_t)(rand() % count);
mac = automac_free_address_mac(random_count);
}
+2 -2
View File
@@ -339,7 +339,7 @@ unsigned Device_Count(
uint32_t Device_Index_To_Instance(
unsigned index)
{
index = index;
(void)index;
return Object_Instance_Number;
}
@@ -957,7 +957,7 @@ bool Device_Write_Property_Local(
break;
}
/* not using len at this time */
len = len;
(void)len;
return status;
}
+4 -4
View File
@@ -212,7 +212,7 @@ void dlmstp_automac_hander(
bool dlmstp_init(
char *ifname)
{
ifname = ifname;
(void)ifname;
Ringbuf_Init(&Transmit_Queue, (uint8_t *) & Transmit_Buffer,
sizeof(struct mstp_tx_packet), MSTP_TRANSMIT_PACKET_COUNT);
Ringbuf_Init(&PDU_Queue, (uint8_t *) & PDU_Buffer,
@@ -466,7 +466,7 @@ static void MSTP_Send_Frame(
crc8 = CRC_Calc_Header(pkt->buffer[5], crc8);
pkt->buffer[6] = data_len % 256;
crc8 = CRC_Calc_Header(pkt->buffer[6], crc8);
pkt->buffer[7] = ~crc8;
pkt->buffer[7] = (uint8_t)(~crc8);
pkt->length = 8;
if (data_len) {
/* calculate CRC for any data */
@@ -1214,7 +1214,7 @@ static bool MSTP_Master_Node_FSM(
/* a proprietary frame that expects a reply is received. */
case MSTP_MASTER_STATE_ANSWER_DATA_REQUEST:
pkt = (struct mstp_pdu_packet *) Ringbuf_Peek(&PDU_Queue);
if (pkt != NULL) {
if (pkt) {
matched =
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
DataLength, SourceAddress, &pkt->buffer[0], pkt->length,
@@ -1243,7 +1243,7 @@ static bool MSTP_Master_Node_FSM(
MSTP_Flag.ReceivedValidFrame = false;
/* clear the queue */
(void) Ringbuf_Pop(&PDU_Queue, NULL);
} else if (rs485_silence_elapsed(Treply_delay) || (pkt != NULL)) {
} else if (rs485_silence_elapsed(Treply_delay) || pkt) {
/* DeferredReply */
/* If no reply will be available from the higher layers */
/* within Treply_delay after the reception of the */
+5 -1
View File
@@ -86,7 +86,11 @@ static uint16_t rs485_turnaround_time(
/* delay after reception before transmitting - per MS/TP spec */
/* wait a minimum 40 bit times since reception */
/* at least 2 ms for errors: rounding, clock tick */
return (2 + ((Tturnaround * 1000UL) / Baud_Rate));
if (Baud_Rate) {
return (2 + ((Tturnaround * 1000UL) / Baud_Rate));
} else {
return 2;
}
}
/*************************************************************************