mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
sched_cpuload.c: misra_c_2012_rule_8_9_violation
Move the static g_cpuload_wdog watchdog timer from file scope to block scope within the cpuload_init() function. This resolves MISRA C 2012 Rule 8.9 violation which requires static variables used by a single function to be scoped at block level. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -90,10 +90,6 @@ volatile clock_t g_cpuload_total;
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SCHED_CPULOAD_SYSCLK
|
||||
static struct wdog_s g_cpuload_wdog;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@@ -287,7 +283,9 @@ int clock_cpuload(int pid, FAR struct cpuload_s *cpuload)
|
||||
#ifdef CONFIG_SCHED_CPULOAD_SYSCLK
|
||||
void cpuload_init(void)
|
||||
{
|
||||
wd_start(&g_cpuload_wdog, CPULOAD_SAMPLING_PERIOD, cpuload_callback,
|
||||
(wdparm_t)&g_cpuload_wdog);
|
||||
static struct wdog_s cpuload_wdog;
|
||||
|
||||
wd_start(&cpuload_wdog, CPULOAD_SAMPLING_PERIOD, cpuload_callback,
|
||||
(wdparm_t)&cpuload_wdog);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user