fix(esp_wifi): Add review comments and some cleanup

This commit is contained in:
Kapil Gupta
2025-01-02 11:10:41 +05:30
parent 0b4bfb451f
commit 4442fe7787
3 changed files with 34 additions and 32 deletions

View File

@@ -845,16 +845,16 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
const u8 *data, size_t data_len,
int no_cck)
{
int ret = 0;
wifi_mgmt_frm_req_t *req = os_zalloc(sizeof(*req) + data_len);;
if (!req) {
return -1;
}
int ret = -1;
wifi_mgmt_frm_req_t *req;
if (!wpa_s->current_bss) {
wpa_printf(MSG_ERROR, "STA not associated, return");
ret = -1;
goto cleanup;
return ret;
}
req = os_zalloc(sizeof(*req) + data_len);
if (!req) {
return ret;
}
req->ifx = WIFI_IF_STA;
@@ -862,14 +862,14 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
req->data_len = data_len;
os_memcpy(req->data, data, req->data_len);
if (esp_wifi_send_mgmt_frm_internal(req) != 0) {
wpa_printf(MSG_ERROR, "action frame sending failed");
ret = -1;
goto cleanup;
}
wpa_printf(MSG_INFO, "action frame sent");
ret = esp_wifi_send_mgmt_frm_internal(req);
if (ret != 0) {
wpa_printf(MSG_ERROR, "action frame sending failed");
} else {
wpa_printf(MSG_INFO, "action frame sent");
}
cleanup:
os_free(req);
return ret;
}