fix(ledc): fix potential null dereference issue & add test case

This commit is contained in:
Chen Chen
2025-12-25 15:02:16 +08:00
parent 851ffae394
commit 698cbe884b
6 changed files with 66 additions and 20 deletions
+11 -8
View File
@@ -396,14 +396,6 @@ void ledc_hal_get_fade_end_intr_status(ledc_hal_context_t *hal, uint32_t *intr_s
*/
void ledc_hal_clear_fade_end_intr_status(ledc_hal_context_t *hal, ledc_channel_t channel_num);
/**
* @brief Get the address of the fade end interrupt status register.
*
* @param hal Context of the HAL layer
* @return Pointer to the fade end interrupt status register.
*/
volatile void* ledc_hal_get_fade_end_intr_addr(ledc_hal_context_t *hal);
/**
* @brief Get clock config of LEDC timer
*
@@ -415,6 +407,17 @@ volatile void* ledc_hal_get_fade_end_intr_addr(ledc_hal_context_t *hal);
*/
void ledc_hal_get_clk_cfg(ledc_hal_context_t *hal, ledc_timer_t timer_sel, ledc_clk_cfg_t *clk_cfg);
/**
* @brief Get the address of the fade end interrupt status register.
*
* @param hal Context of the HAL layer
* @return Pointer to the fade end interrupt status register.
*/
static inline volatile void* ledc_hal_get_fade_end_intr_addr(ledc_hal_context_t *hal)
{
return ledc_ll_get_fade_end_intr_addr(hal->dev);
}
#endif //#if SOC_LEDC_SUPPORTED
#ifdef __cplusplus
+5 -5
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -153,7 +153,7 @@ extern "C" {
#endif
#if SOC_SDIO_SLAVE_SUPPORTED
/// Space used for each sending descriptor. Should initialize the sendbuf accoring to this size.
/// Space used for each sending descriptor. Should initialize the sendbuf according to this size.
#define SDIO_SLAVE_SEND_DESC_SIZE sizeof(sdio_slave_hal_send_desc_t)
@@ -239,7 +239,7 @@ typedef struct {
/**
* Initialize the HAL, should provide buffers to the context and configure the
* members before this funciton is called.
* members before this function is called.
*
* @param hal Context of the HAL layer.
*/
@@ -350,7 +350,7 @@ esp_err_t sdio_slave_hal_send_get_next_finished_arg(sdio_slave_context_t *hal, v
*
* @note Only call when the DMA is stopped!
* @param hal Context of the HAL layer.
* @param out_arg Argument indiciating the buffer to send
* @param out_arg Argument indicating the buffer to send
* @param out_return_cnt Space in the queue released after this descriptor is flushed.
* @return
* - ESP_ERR_INVALID_STATE: This function call be called only when the DMA is stopped.
@@ -476,7 +476,7 @@ void sdio_slave_hal_recv_flush_one_buffer(sdio_slave_context_t *hal);
/**
* Enable some of the interrupts for the host.
*
* @note May have concurrency issue wit the host or other tasks, suggest only use it during
* @note May have concurrency issue with the host or other tasks, suggest only use it during
* initialization.
* @param hal Context of the HAL layer.
* @param mask Bitwise mask for the interrupts to enable.