Skip to content

Commit ecaa19b

Browse files
muahmed-silabskartben
authored andcommitted
drivers: wifi: siwx91x: Remove set credential for open mode
Removed the unnecessary set_credential API call in open security mode Signed-off-by: Muzaffar Ahmed <muzaffar.ahmed@silabs.com>
1 parent 9600995 commit ecaa19b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

drivers/wifi/siwx91x/siwx91x_wifi.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,6 @@ static int siwx91x_ap_enable(const struct device *dev, struct wifi_connect_req_p
738738
{
739739
sl_wifi_interface_t interface = sl_wifi_get_default_interface();
740740
struct siwx91x_dev *sidev = dev->data;
741-
/* Wiseconnect requires a valid PSK even if WIFI_SECURITY_TYPE_NONE is selected */
742-
static const char dummy_psk[] = "dummy_value";
743741
sl_wifi_ap_configuration_t saved_ap_cfg;
744742
int ret;
745743
int sec;
@@ -807,18 +805,14 @@ static int siwx91x_ap_enable(const struct device *dev, struct wifi_connect_req_p
807805
}
808806

809807
siwx91x_ap_cfg.security = sec;
810-
if (params->security == WIFI_SECURITY_TYPE_NONE) {
811-
ret = sl_net_set_credential(siwx91x_ap_cfg.credential_id, SL_NET_WIFI_PSK,
812-
dummy_psk, strlen(dummy_psk));
813-
} else {
808+
if (params->security != WIFI_SECURITY_TYPE_NONE) {
814809
ret = sl_net_set_credential(siwx91x_ap_cfg.credential_id, SL_NET_WIFI_PSK,
815810
params->psk, params->psk_length);
816-
}
817-
818-
if (ret != SL_STATUS_OK) {
819-
LOG_ERR("Failed to set credentials: 0x%x", ret);
820-
wifi_mgmt_raise_ap_enable_result_event(sidev->iface, WIFI_STATUS_AP_FAIL);
821-
return -EINVAL;
811+
if (ret != SL_STATUS_OK) {
812+
LOG_ERR("Failed to set credentials: 0x%x", ret);
813+
wifi_mgmt_raise_ap_enable_result_event(sidev->iface, WIFI_STATUS_AP_FAIL);
814+
return -EINVAL;
815+
}
822816
}
823817

824818
ret = siwx91x_nwp_reboot_if_required(dev, WIFI_SOFTAP_MODE);

0 commit comments

Comments
 (0)