sdmmc: Correctly check function parameters before using them
Closes https://github.com/espressif/esp-idf/pull/5000
This commit is contained in:
parent
af97a5abc3
commit
fb0fa34ac8
|
@ -306,10 +306,6 @@ static void configure_pin(int pin)
|
||||||
|
|
||||||
esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config)
|
esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config)
|
||||||
{
|
{
|
||||||
bool pullup = slot_config->flags & SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
|
|
||||||
if (pullup) {
|
|
||||||
sdmmc_host_pullup_en(slot, slot_config->width);
|
|
||||||
}
|
|
||||||
if (!s_intr_handle) {
|
if (!s_intr_handle) {
|
||||||
return ESP_ERR_INVALID_STATE;
|
return ESP_ERR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
@ -319,6 +315,10 @@ esp_err_t sdmmc_host_init_slot(int slot, const sdmmc_slot_config_t* slot_config)
|
||||||
if (slot_config == NULL) {
|
if (slot_config == NULL) {
|
||||||
return ESP_ERR_INVALID_ARG;
|
return ESP_ERR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
bool pullup = slot_config->flags & SDMMC_SLOT_FLAG_INTERNAL_PULLUP;
|
||||||
|
if (pullup) {
|
||||||
|
sdmmc_host_pullup_en(slot, slot_config->width);
|
||||||
|
}
|
||||||
int gpio_cd = slot_config->gpio_cd;
|
int gpio_cd = slot_config->gpio_cd;
|
||||||
int gpio_wp = slot_config->gpio_wp;
|
int gpio_wp = slot_config->gpio_wp;
|
||||||
uint8_t slot_width = slot_config->width;
|
uint8_t slot_width = slot_config->width;
|
||||||
|
|
Loading…
Reference in a new issue