mirror of
https://github.com/apache/nuttx.git
synced 2026-08-09 06:25:09 +00:00
sched_profil.c: misra_c_2012_rule_8_9_violation
Move static g_prof variable declaration into block scope for the profil() function when CONFIG_SMP is disabled, following MISRA C 2012 Rule 8.9 which requires objects used by only one function to be declared within that function's scope. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
dde0d7405d
commit
c7bb7ece8e
1 changed files with 4 additions and 2 deletions
|
|
@ -58,9 +58,8 @@ static int profil_timer_handler_cpu(FAR void *arg);
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct profinfo_s g_prof;
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
static struct profinfo_s g_prof;
|
||||
static struct smp_call_data_s g_call_data =
|
||||
SMP_CALL_INITIALIZER(profil_timer_handler_cpu, &g_prof);
|
||||
#endif
|
||||
|
|
@ -137,6 +136,9 @@ static void profil_timer_handler(wdparm_t arg)
|
|||
int profil(FAR unsigned short *buf, size_t bufsiz,
|
||||
size_t offset, unsigned int scale)
|
||||
{
|
||||
#ifndef CONFIG_SMP
|
||||
static struct profinfo_s g_prof;
|
||||
#endif
|
||||
FAR struct profinfo_s *prof = &g_prof;
|
||||
irqstate_t flags;
|
||||
uintptr_t highpc;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue