Merge branch 'bugfix/es_idf_clkicg_idf-13119' into 'master'

fix(esp_hw_support): fix dead code and out-of-bounds in esp_sleep_clock_config function

Closes IDF-13119 and IDF-13103

See merge request espressif/esp-idf!40989
This commit is contained in:
He Binglin
2025-08-15 13:08:36 +08:00
2 changed files with 3 additions and 2 deletions

View File

@@ -110,7 +110,8 @@ typedef enum {
*/ */
typedef enum { typedef enum {
ESP_SLEEP_CLOCK_OPTION_GATE, //!< Gate the clock in sleep mode ESP_SLEEP_CLOCK_OPTION_GATE, //!< Gate the clock in sleep mode
ESP_SLEEP_CLOCK_OPTION_UNGATE //!< Ungate the clock in sleep mode ESP_SLEEP_CLOCK_OPTION_UNGATE, //!< Ungate the clock in sleep mode
ESP_SLEEP_CLOCK_OPTION_MAX
} esp_sleep_clock_option_t; } esp_sleep_clock_option_t;
/** /**

View File

@@ -2540,7 +2540,7 @@ int32_t* esp_sleep_sub_mode_dump_config(FILE *stream) {
#if SOC_PM_SUPPORT_PMU_CLK_ICG #if SOC_PM_SUPPORT_PMU_CLK_ICG
esp_err_t esp_sleep_clock_config(esp_sleep_clock_t clock, esp_sleep_clock_option_t option) esp_err_t esp_sleep_clock_config(esp_sleep_clock_t clock, esp_sleep_clock_option_t option)
{ {
if (clock > ESP_SLEEP_CLOCK_MAX || option > ESP_SLEEP_CLOCK_OPTION_UNGATE) { if (clock >= ESP_SLEEP_CLOCK_MAX || option >= ESP_SLEEP_CLOCK_OPTION_MAX) {
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }