mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
fix(drivers): some false reports from coverity
This commit is contained in:
@@ -23,13 +23,11 @@ static esp_err_t ana_cmpr_del_etm_event(esp_etm_event_handle_t base_event)
|
||||
|
||||
esp_err_t ana_cmpr_new_etm_event(ana_cmpr_handle_t cmpr, const ana_cmpr_etm_event_config_t *config, esp_etm_event_handle_t *ret_event)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
ana_cmpr_etm_event_t *event = NULL;
|
||||
ana_cmpr_unit_t unit = ana_cmpr_get_unit_id(cmpr);
|
||||
ESP_RETURN_ON_FALSE(((int)unit) >= 0, ESP_ERR_INVALID_ARG, TAG, "invalid analog comparator handle");
|
||||
ESP_RETURN_ON_FALSE(config && ret_event, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
event = heap_caps_calloc(1, sizeof(ana_cmpr_etm_event_t), ETM_MEM_ALLOC_CAPS);
|
||||
ESP_GOTO_ON_FALSE(event, ESP_ERR_NO_MEM, err, TAG, "no mem for analog comparator event");
|
||||
ana_cmpr_etm_event_t *event = heap_caps_calloc(1, sizeof(ana_cmpr_etm_event_t), ETM_MEM_ALLOC_CAPS);
|
||||
ESP_RETURN_ON_FALSE(event, ESP_ERR_NO_MEM, TAG, "no mem for analog comparator event");
|
||||
|
||||
uint32_t event_id = ANALOG_CMPR_LL_ETM_SOURCE(unit, config->event_type);
|
||||
event->base.del = ana_cmpr_del_etm_event;
|
||||
@@ -38,11 +36,4 @@ esp_err_t ana_cmpr_new_etm_event(ana_cmpr_handle_t cmpr, const ana_cmpr_etm_even
|
||||
ESP_LOGD(TAG, "new event @%p, event_id=%"PRIu32", unit_id=%d", event, event_id, unit);
|
||||
*ret_event = &event->base;
|
||||
return ESP_OK;
|
||||
|
||||
err:
|
||||
if (event) {
|
||||
free(event);
|
||||
event = NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@@ -740,6 +740,7 @@ esp_err_t parlio_rx_unit_enable(parlio_rx_unit_handle_t rx_unit, bool reset_queu
|
||||
parlio_ll_rx_enable_clock(hal->regs, false);
|
||||
}
|
||||
}
|
||||
assert(trans.delimiter);
|
||||
parlio_rx_set_delimiter_config(rx_unit, trans.delimiter);
|
||||
parlio_rx_mount_transaction_buffer(rx_unit, &trans);
|
||||
gdma_start(rx_unit->dma_chan, (intptr_t)rx_unit->curr_desc);
|
||||
|
@@ -258,7 +258,8 @@ esp_err_t ppa_do_blend(ppa_client_handle_t ppa_client, const ppa_blend_oper_conf
|
||||
|
||||
esp_err_t ret = ESP_OK;
|
||||
ppa_trans_t *trans_elm = NULL;
|
||||
if (xQueueReceive(ppa_client->trans_elm_ptr_queue, (void *)&trans_elm, 0)) {
|
||||
if (xQueueReceive(ppa_client->trans_elm_ptr_queue, (void *)&trans_elm, 0) == pdTRUE) {
|
||||
assert(trans_elm);
|
||||
dma2d_trans_config_t *dma_trans_desc = trans_elm->trans_desc;
|
||||
|
||||
ppa_dma2d_trans_on_picked_config_t *trans_on_picked_desc = dma_trans_desc->user_config;
|
||||
|
@@ -113,7 +113,8 @@ esp_err_t ppa_do_fill(ppa_client_handle_t ppa_client, const ppa_fill_oper_config
|
||||
|
||||
esp_err_t ret = ESP_OK;
|
||||
ppa_trans_t *trans_elm = NULL;
|
||||
if (xQueueReceive(ppa_client->trans_elm_ptr_queue, (void *)&trans_elm, 0)) {
|
||||
if (xQueueReceive(ppa_client->trans_elm_ptr_queue, (void *)&trans_elm, 0) == pdTRUE) {
|
||||
assert(trans_elm);
|
||||
dma2d_trans_config_t *dma_trans_desc = trans_elm->trans_desc;
|
||||
|
||||
ppa_dma2d_trans_on_picked_config_t *trans_on_picked_desc = dma_trans_desc->user_config;
|
||||
|
@@ -252,7 +252,8 @@ esp_err_t ppa_do_scale_rotate_mirror(ppa_client_handle_t ppa_client, const ppa_s
|
||||
|
||||
esp_err_t ret = ESP_OK;
|
||||
ppa_trans_t *trans_elm = NULL;
|
||||
if (xQueueReceive(ppa_client->trans_elm_ptr_queue, (void *)&trans_elm, 0)) {
|
||||
if (xQueueReceive(ppa_client->trans_elm_ptr_queue, (void *)&trans_elm, 0) == pdTRUE) {
|
||||
assert(trans_elm);
|
||||
dma2d_trans_config_t *dma_trans_desc = trans_elm->trans_desc;
|
||||
|
||||
ppa_dma2d_trans_on_picked_config_t *trans_on_picked_desc = dma_trans_desc->user_config;
|
||||
|
@@ -42,6 +42,7 @@ touch_sensor_handle_t g_touch = NULL;
|
||||
static void touch_channel_pin_init(int id)
|
||||
{
|
||||
gpio_num_t pin = touch_sensor_channel_io_map[id];
|
||||
assert(pin >= 0);
|
||||
if (esp_gpio_reserve(BIT64(pin)) & BIT64(pin)) {
|
||||
ESP_LOGW(TAG, "The GPIO%d is conflict with other module", (int)pin);
|
||||
}
|
||||
|
@@ -198,6 +198,7 @@ esp_err_t touch_priv_config_controller(touch_sensor_handle_t sens_handle, const
|
||||
sens_handle->sample_cfg_num = 1; // Only have one set of sampling configuration
|
||||
|
||||
/* Configure the hardware */
|
||||
assert(hal_cfg.sample_cfg_num == 1);
|
||||
TOUCH_ENTER_CRITICAL(TOUCH_PERIPH_LOCK);
|
||||
touch_hal_config_controller(&hal_cfg);
|
||||
touch_ll_reset_trigger_groups();
|
||||
|
@@ -88,6 +88,8 @@ static bool uhci_gdma_tx_callback_eof(gdma_channel_handle_t dma_chan, gdma_event
|
||||
expected_fsm = UHCI_TX_FSM_ENABLE;
|
||||
if (atomic_compare_exchange_strong(&uhci_ctrl->tx_dir.tx_fsm, &expected_fsm, UHCI_TX_FSM_RUN_WAIT)) {
|
||||
if (xQueueReceiveFromISR(uhci_ctrl->tx_dir.trans_queues[UHCI_TRANS_QUEUE_PROGRESS], &trans_desc, &do_yield) == pdTRUE) {
|
||||
// sanity check
|
||||
assert(trans_desc);
|
||||
atomic_store(&uhci_ctrl->tx_dir.tx_fsm, UHCI_TX_FSM_RUN);
|
||||
uhci_do_transmit(uhci_ctrl, trans_desc);
|
||||
if (do_yield) {
|
||||
@@ -219,7 +221,7 @@ static esp_err_t uhci_gdma_initialize(uhci_controller_handle_t uhci_ctrl, const
|
||||
ESP_RETURN_ON_ERROR(gdma_new_link_list(&dma_link_config, &uhci_ctrl->rx_dir.dma_link), TAG, "DMA rx link list alloc failed");
|
||||
ESP_LOGD(TAG, "rx_dma node number is %d", uhci_ctrl->rx_dir.rx_num_dma_nodes);
|
||||
|
||||
uhci_ctrl->rx_dir.buffer_size_per_desc_node = heap_caps_calloc(uhci_ctrl->rx_dir.rx_num_dma_nodes, sizeof(uhci_ctrl->rx_dir.buffer_size_per_desc_node), UHCI_MEM_ALLOC_CAPS);
|
||||
uhci_ctrl->rx_dir.buffer_size_per_desc_node = heap_caps_calloc(uhci_ctrl->rx_dir.rx_num_dma_nodes, sizeof(*uhci_ctrl->rx_dir.buffer_size_per_desc_node), UHCI_MEM_ALLOC_CAPS);
|
||||
ESP_RETURN_ON_FALSE(uhci_ctrl->rx_dir.buffer_size_per_desc_node, ESP_ERR_NO_MEM, TAG, "no memory for recording buffer size for desc node");
|
||||
uhci_ctrl->rx_dir.buffer_pointers = heap_caps_calloc(uhci_ctrl->rx_dir.rx_num_dma_nodes, sizeof(*uhci_ctrl->rx_dir.buffer_pointers), UHCI_MEM_ALLOC_CAPS);
|
||||
ESP_RETURN_ON_FALSE(uhci_ctrl->rx_dir.buffer_pointers, ESP_ERR_NO_MEM, TAG, "no memory for recording buffer pointers for desc node");
|
||||
|
Reference in New Issue
Block a user