fix(esp_eth): fixing memory leak and invalid bit shift

This commit is contained in:
Ondrej Kosta 2024-05-15 09:27:37 +02:00
parent 6b34b6c1fb
commit a558e94952
2 changed files with 7 additions and 2 deletions

View File

@ -574,8 +574,8 @@ static esp_err_t emac_esp_alloc_driver_obj(const eth_mac_config_t *config, emac_
config->rx_task_prio, &emac->rx_task_hdl, core_num);
ESP_GOTO_ON_FALSE(xReturned == pdPASS, ESP_FAIL, err, TAG, "create emac_rx task failed");
*emac_out_hdl = emac;
err:
*emac_out_hdl = emac;
return ret;
}

View File

@ -28,7 +28,7 @@ static uint64_t s_emac_esp_used_gpio_mask = 0x0;
static esp_err_t emac_esp_gpio_matrix_init(gpio_num_t gpio_num, uint32_t signal_in_idx, uint32_t signal_out_idx, gpio_mode_t mode)
{
// silently skip when user don't want to connect the signal to GPIO pad
if (gpio_num == GPIO_NUM_NC) {
if (gpio_num <= GPIO_NUM_NC) {
ESP_LOGD(TAG, "%s skipping signal in_idx %" PRIu32 ", out_idx %" PRIu32, __func__, signal_in_idx, signal_out_idx);
return ESP_OK;
}
@ -74,6 +74,11 @@ static esp_err_t emac_esp_iomux_init(gpio_num_t gpio_num, const emac_iomux_info_
ESP_LOGD(TAG, "%s skipping target undefined iomux periph function", __func__);
return ESP_OK;
}
// silently skip when user don't want to iomux the function to GPIO pad
if (gpio_num <= GPIO_NUM_NC) {
ESP_LOGD(TAG, "%s user defined GPIO not connected - skipping", __func__);
return ESP_OK;
}
// loop over target iomux_info until reached end of list indicated by invalid GPIO num
while (iomux_info->gpio_num != GPIO_NUM_MAX) {
// if requested GPIO number can be IO muxed or select single pad that can be muxed on the target