Skip to content

Commit 190a129

Browse files
committed
Merge branch 'fix/fix_timer_wakeup_api_coverity' into 'master'
fix(esp_hw_support): fix esp_sleep_enable_timer_wakeup API code coverity Closes IDF-12526 See merge request espressif/esp-idf!37639
2 parents 6b4f08c + 1bb28af commit 190a129

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/esp_hw_support/sleep_modes.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,9 @@ esp_err_t esp_sleep_enable_ulp_wakeup(void)
16461646
esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us)
16471647
{
16481648
#if CONFIG_SOC_CLK_TREE_SUPPORTED
1649-
if (time_in_us > ((BIT64(SOC_LP_TIMER_BIT_WIDTH_LO + SOC_LP_TIMER_BIT_WIDTH_HI) - 1) / esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_APPROX)) * MHZ ) {
1649+
uint32_t lp_slow_freq_hz = esp_clk_tree_lp_slow_get_freq_hz(ESP_CLK_TREE_SRC_FREQ_PRECISION_APPROX);
1650+
assert(lp_slow_freq_hz);
1651+
if (time_in_us > ((BIT64(SOC_LP_TIMER_BIT_WIDTH_LO + SOC_LP_TIMER_BIT_WIDTH_HI) - 1) / lp_slow_freq_hz) * MHZ ) {
16501652
return ESP_ERR_INVALID_ARG;
16511653
}
16521654
#endif

0 commit comments

Comments
 (0)