mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 13:13:08 +08:00
Fix suspect DEBUGASSERT() like PR765
As pointed out by Şükrü Bahadır Arslan in PR765, function calls inside DEBUGASSERT() will not be executed if DEBUGASSERT is disabled. Following that PR, I searched for other instances of similar errors and found four. As there are many thousands of DEBUGASSERT in the code, this is *not* an exhaustive fix. arch/arm/src/tms570/tms570_boot.c: * In function arm_boot(), call tms570_memtest_complete() outside of the DEBUGASSERT(). Otherwise, if DEBUGASSERT is disabled, we will never rendezvous with completion of the test. (Two instances of this fix.) arch/arm/src/tms570/tms570_clockconfig.c: * In function tms570_clockconfig(), call tms570_efc_selftest_complete() outside of the DEBUGASSERT() for the same reason as above. boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c: * In function board_late_initialize(), call sam_watchdog_initialize() outside of the DEBUGASSERT() for the same reason as above.
This commit is contained in:
committed by
patacongo
parent
759d8c1bfa
commit
743dcd8acf
@@ -297,6 +297,10 @@ static void go_nx_start(void)
|
||||
|
||||
void arm_boot(void)
|
||||
{
|
||||
#ifdef CONFIG_TMS570_SELFTEST
|
||||
int check;
|
||||
#endif /* CONFIG_TMS570_SELFTEST */
|
||||
|
||||
/* Enable CPU Event Export.
|
||||
*
|
||||
* This allows the CPU to signal any single-bit or double-bit errors
|
||||
@@ -340,7 +344,8 @@ void arm_boot(void)
|
||||
/* Run the memory selftest on CPU RAM. */
|
||||
|
||||
tms570_memtest_start(PBIST_RINFOL_ESRAM1_RAM);
|
||||
DEBUGASSERT(tms570_memtest_complete() == OK);
|
||||
check = tms570_memtest_complete();
|
||||
DEBUGASSERT(check == OK);
|
||||
#endif /* CONFIG_TMS570_SELFTEST */
|
||||
|
||||
/* Initialize CPU RAM. */
|
||||
@@ -379,7 +384,9 @@ void arm_boot(void)
|
||||
|
||||
/* Wait for the memory test to complete */
|
||||
|
||||
DEBUGASSERT(tms570_memtest_complete() == OK);
|
||||
check = tms570_memtest_complete();
|
||||
DEBUGASSERT(check == OK);
|
||||
UNUSED(check);
|
||||
#endif /* CONFIG_TMS570_SELFTEST */
|
||||
|
||||
#ifdef CONFIG_TMS570_MIBASPI1
|
||||
|
||||
@@ -816,6 +816,10 @@ static void tms570_eclk_configure(void)
|
||||
|
||||
void tms570_clockconfig(void)
|
||||
{
|
||||
#ifdef CONFIG_TMS570_SELFTEST
|
||||
int check;
|
||||
#endif /* CONFIG_TMS570_SELFTEST */
|
||||
|
||||
/* Configure PLL control registers and enable PLLs. */
|
||||
|
||||
tms570_pll_setup();
|
||||
@@ -839,8 +843,10 @@ void tms570_clockconfig(void)
|
||||
#ifdef CONFIG_TMS570_SELFTEST
|
||||
/* Wait for eFuse controller self-test to complete and check results */
|
||||
|
||||
DEBUGASSERT(tms570_efc_selftest_complete() == 0);
|
||||
#endif
|
||||
check = tms570_efc_selftest_complete();
|
||||
DEBUGASSERT(check == 0);
|
||||
UNUSED(check);
|
||||
#endif /* CONFIG_TMS570_SELFTEST */
|
||||
|
||||
/* Set up flash address and data wait states. */
|
||||
|
||||
|
||||
@@ -89,7 +89,9 @@ void board_late_initialize(void)
|
||||
#if (defined(CONFIG_SAM34_WDT) && !defined(CONFIG_WDT_DISABLE_ON_RESET))
|
||||
/* Configure watchdog timer and enable kicker kernel thread. */
|
||||
|
||||
DEBUGASSERT(sam_watchdog_initialize() >= 0);
|
||||
int check = sam_watchdog_initialize();
|
||||
DEBUGASSERT(check >= 0);
|
||||
UNUSED(check);
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
Reference in New Issue
Block a user