From 29592e3e83a8f4096e68d88a1eb5ea5650ff9ed9 Mon Sep 17 00:00:00 2001 From: dongyou Date: Mon, 14 Sep 2020 19:21:31 +0800 Subject: [PATCH] wifi: Fix spin lock allocation in PSRAM bug Closes https://github.com/espressif/esp-idf/issues/5629 --- components/esp_wifi/esp32/esp_adapter.c | 2 +- components/esp_wifi/esp32s2/esp_adapter.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_wifi/esp32/esp_adapter.c b/components/esp_wifi/esp32/esp_adapter.c index ec684c088b..09c283ba7e 100644 --- a/components/esp_wifi/esp32/esp_adapter.c +++ b/components/esp_wifi/esp32/esp_adapter.c @@ -182,7 +182,7 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg) static void * spin_lock_create_wrapper(void) { portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = malloc(sizeof(portMUX_TYPE)); + void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); if (mux) { memcpy(mux,&tmp,sizeof(portMUX_TYPE)); diff --git a/components/esp_wifi/esp32s2/esp_adapter.c b/components/esp_wifi/esp32s2/esp_adapter.c index 23ef893f97..2399f81c46 100644 --- a/components/esp_wifi/esp32s2/esp_adapter.c +++ b/components/esp_wifi/esp32s2/esp_adapter.c @@ -172,7 +172,7 @@ static void set_isr_wrapper(int32_t n, void *f, void *arg) static void * spin_lock_create_wrapper(void) { portMUX_TYPE tmp = portMUX_INITIALIZER_UNLOCKED; - void *mux = malloc(sizeof(portMUX_TYPE)); + void *mux = heap_caps_malloc(sizeof(portMUX_TYPE), MALLOC_CAP_8BIT|MALLOC_CAP_INTERNAL); if (mux) { memcpy(mux,&tmp,sizeof(portMUX_TYPE));