fix glb_clk may be uninitialized build error in ledc driver (IDFGH-7450) #9025
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am not sure if this is a complete solution to the problem, but at least it seems to fix it on esp32.
The issue was introduced in: d64c6f5 ledc: cleanup the clock selection code
The offending line is a print: line 570: ESP_LOGD(LEDC_TAG, "In slow speed mode, global clk set: %d", glb_clk);
Am I missing something else here?
build error:
In file included from components/driver/ledc.c:10:
components/driver/ledc.c: In function 'ledc_set_timer_div':
components/log/include/esp_log.h:419:47: error: 'glb_clk' may be used uninitialized in this function [-Werror=maybe-uninitialized]
else if (level==ESP_LOG_DEBUG ) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_SYSTEM_TIME_FORMAT(D, format), esp_log_system_timestamp(), tag, ##VA_ARGS); }
^~~~~~~~~~~~~
components/driver/ledc.c:497:25: note: 'glb_clk' was declared here
ledc_slow_clk_sel_t glb_clk;
^~~~~~~