Address a few MISRA 2.2 violations in FreeRTOS_IP.c (#230)

* Make changes for MISRA rule 2.2

* Add comments to explain changes

* Fix a typo

* Actually fix a typo

I missed a spot in the previous commit.
This commit is contained in:
Aniruddha Kanhere 2020-08-31 12:55:38 -07:00 committed by GitHub
parent e2ab092351
commit 18d238ad5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2105,6 +2105,11 @@ uint8_t ucProtocol;
if( xResult != pdPASS ) if( xResult != pdPASS )
{ {
FreeRTOS_printf( ( "xCheckSizeFields: location %ld\n", xLocation ) ); FreeRTOS_printf( ( "xCheckSizeFields: location %ld\n", xLocation ) );
/* If FreeRTOS_printf is not defined, not using xLocation will be a violation of MISRA
* rule 2.2 as the value assigned to xLocation will not be used. The below statement uses
* the variable without modifying the logic of the source. */
( void ) xLocation;
} }
return xResult; return xResult;
@ -2379,6 +2384,11 @@ BaseType_t location = 0;
( usChecksum == ipINVALID_LENGTH ) ) ( usChecksum == ipINVALID_LENGTH ) )
{ {
FreeRTOS_printf( ( "CRC error: %04x location %ld\n", usChecksum, location ) ); FreeRTOS_printf( ( "CRC error: %04x location %ld\n", usChecksum, location ) );
/* If FreeRTOS_printf is not defined, not using 'location' will be a violation of MISRA
* rule 2.2 as the value assigned to 'location' will not be used. The below statement uses
* the variable without modifying the logic of the source. */
( void ) location;
} }
return usChecksum; return usChecksum;