From 5bb496bfeec16c91cbfa938c8c2b521b22fd039b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 2 Jan 2020 21:26:57 -0600 Subject: [PATCH 1/2] Documentation/NuttXCCodingStandard.html: Remove requirement to decorate ignored returned values with (void). --- Documentation/NuttXCCodingStandard.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Documentation/NuttXCCodingStandard.html b/Documentation/NuttXCCodingStandard.html index 2b187b50fc110..74522f2ed2710 100644 --- a/Documentation/NuttXCCodingStandard.html +++ b/Documentation/NuttXCCodingStandard.html @@ -87,7 +87,7 @@

Table of Contents

NuttX C Coding Standard

-

Last Updated: July 6, 2019

+

Last Updated: January 2, 2020

@@ -2182,9 +2182,8 @@

Returned Values

Checking Return Values. Callers of internal OS functions should always check return values for an error. At a minimum, a debug statement should indicate that an error has occurred. - The calling logic intentionally ignores the returned value, then the function return value should be explicitly cast to (void) to indicate that the return value is intentionally ignored. - An exception of for standard functions for which people have historically ignored the returned values, such as printf() or close. - All calls to malloc or realloc must be checked for failures to allocate memory. + Ignored return values are always suspicious. + All calls to malloc or realloc, in particular, must be checked for failures to allocate memory to avoid use of NULL pointers.

From 4489753d67a1e080e8656491f3f32e445689f8df Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 4 Jan 2020 10:41:21 -0600 Subject: [PATCH 2/2] sched_mergepending.c: Correct some errors in comments. --- sched/sched/sched_mergepending.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/sched/sched/sched_mergepending.c b/sched/sched/sched_mergepending.c index a5840f0335e4d..3f4acff54a574 100644 --- a/sched/sched/sched_mergepending.c +++ b/sched/sched/sched_mergepending.c @@ -76,11 +76,10 @@ * a context switch is needed. * * Assumptions: - * - The caller has established a critical section before - * calling this function (calling sched_lock() first is NOT - * a good idea -- use enter_critical_section()). - * - The caller handles the condition that occurs if the - * the head of the sched_mergTSTATE_TASK_PENDINGs is changed. + * - The caller has established a critical section before calling this + * function. + * - The caller handles the condition that occurs if the head of the + * ready-to-run task list is changed. * ****************************************************************************/ @@ -181,11 +180,10 @@ bool sched_mergepending(void) * a context switch is needed. * * Assumptions: - * - The caller has established a critical section before - * calling this function (calling sched_lock() first is NOT - * a good idea -- use enter_critical_section()). - * - The caller handles the condition that occurs if the - * the head of the sched_mergTSTATE_TASK_PENDINGs is changed. + * - The caller has established a critical section before calling this + * function. + * - The caller handles the condition that occurs if the head of the + * ready-to-run task list is changed. * ****************************************************************************/ @@ -261,7 +259,7 @@ bool sched_mergepending(void) (FAR dq_queue_t *)&g_pendingtasks, TSTATE_TASK_PENDING); - /* And return with the schedule locked and tasks in the + /* And return with the scheduler locked and tasks in the * pending task list. */