mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-16 01:37:45 -04:00
Address MISRA Rule violations (#274)
* Use unsigned types/constants where needed. * Address MISRA 21.15 violations in FreeRTOS_Sockets.c * Address MISRA rule violations in code (primarily Rule 2.2) * Inline had been disabled for Coverity builds, preventing Coverity from correctly identifying dead code; this change removes the disabling of inline during Coverity builds. * Added an explanation for the inline suppression of Rule 11.4 in prvSocketValid(). Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
This commit is contained in:
parent
50dc98a5a6
commit
c997d887e0
3 changed files with 42 additions and 50 deletions
|
@ -207,8 +207,19 @@ typedef struct xSOCKET const * ConstSocket_t;
|
|||
|
||||
static portINLINE unsigned int prvSocketValid( Socket_t xSocket )
|
||||
{
|
||||
unsigned int lReturnValue = pdFALSE;
|
||||
/*
|
||||
* There are two values which can indicate an invalid socket:
|
||||
* FREERTOS_INVALID_SOCKET and NULL. In order to compare against
|
||||
* both values, the code cannot be compliant with rule 11.4,
|
||||
* hence the Coverity suppression statement below.
|
||||
*/
|
||||
/* coverity[misra_c_2012_rule_11_4_violation] */
|
||||
return ( ( xSocket != FREERTOS_INVALID_SOCKET ) && ( xSocket != NULL ) );
|
||||
if( ( xSocket != FREERTOS_INVALID_SOCKET ) && ( xSocket != NULL ) )
|
||||
{
|
||||
lReturnValue = pdTRUE;
|
||||
}
|
||||
return lReturnValue;
|
||||
}
|
||||
|
||||
#if( ipconfigSUPPORT_SELECT_FUNCTION == 1 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue