Commit ecaa19b7 authored by Muzaffar Ahmed's avatar Muzaffar Ahmed Committed by Benjamin Cabé
Browse files

drivers: wifi: siwx91x: Remove set credential for open mode

Removed the unnecessary set_credential API call in open security mode

Signed-off-by: default avatarMuzaffar Ahmed <muzaffar.ahmed@silabs.com>
parent 9600995a
Loading
Loading
Loading
Loading
+2 −8
Changes for drivers/wifi/siwx91x/siwx91x_wifi.c: 2 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -738,8 +738,6 @@ static int siwx91x_ap_enable(const struct device *dev, struct wifi_connect_req_p
{
	sl_wifi_interface_t interface = sl_wifi_get_default_interface();
	struct siwx91x_dev *sidev = dev->data;
	/* Wiseconnect requires a valid PSK even if WIFI_SECURITY_TYPE_NONE is selected */
	static const char dummy_psk[] = "dummy_value";
	sl_wifi_ap_configuration_t saved_ap_cfg;
	int ret;
	int sec;
@@ -807,19 +805,15 @@ static int siwx91x_ap_enable(const struct device *dev, struct wifi_connect_req_p
	}

	siwx91x_ap_cfg.security = sec;
	if (params->security == WIFI_SECURITY_TYPE_NONE) {
		ret = sl_net_set_credential(siwx91x_ap_cfg.credential_id, SL_NET_WIFI_PSK,
					    dummy_psk, strlen(dummy_psk));
	} else {
	if (params->security != WIFI_SECURITY_TYPE_NONE) {
		ret = sl_net_set_credential(siwx91x_ap_cfg.credential_id, SL_NET_WIFI_PSK,
					    params->psk, params->psk_length);
	}

		if (ret != SL_STATUS_OK) {
			LOG_ERR("Failed to set credentials: 0x%x", ret);
			wifi_mgmt_raise_ap_enable_result_event(sidev->iface, WIFI_STATUS_AP_FAIL);
			return -EINVAL;
		}
	}

	ret = siwx91x_nwp_reboot_if_required(dev, WIFI_SOFTAP_MODE);
	if (ret < 0) {