saramonteiro commented on a change in pull request #2939: URL: https://github.com/apache/incubator-nuttx/pull/2939#discussion_r593163753
########## File path: arch/xtensa/src/esp32/esp32_wifi_adapter.c ########## @@ -516,6 +561,70 @@ static inline int32_t esp_errno_trans(int ret) } } +/**************************************************************************** + * Name: osi_errno_trans + * + * Description: + * Transform from ESP WiFi error code to NuttX error code + * + * Input Parameters: + * ret - ESP WiFi error code + * + * Returned Value: + * NuttX error code + * + ****************************************************************************/ + +static int32_t wifi_errno_trans(int ret) +{ + int wifierr; + + /* Unmask component error bits */ + + wifierr = ret & 0xfff; + + if (wifierr == ESP_OK) + { + return 0; + } + else if (wifierr == ESP_ERR_NO_MEM) + { + return -ENOMEM; + } + else if (wifierr == ESP_ERR_INVALID_ARG) + { + return -EINVAL; + } + else if (wifierr == ESP_ERR_INVALID_STATE) + { + return -EIO; + } + else if (wifierr == ESP_ERR_INVALID_SIZE) + { + return -EINVAL; + } + else if (wifierr == ESP_ERR_NOT_FOUND) + { + return -ENOSYS; + } + else if (wifierr == ESP_ERR_NOT_SUPPORTED) + { + return -ENOSYS; + } + else if (wifierr == ESP_ERR_TIMEOUT) + { + return -ETIMEDOUT; + } + else if (wifierr == ESP_ERR_INVALID_MAC) + { + return -EINVAL; + } + else + { + return -1; Review comment: ```suggestion return ERROR; ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org