From 380620a013df5bdf7c779449251580b3bc254d81 Mon Sep 17 00:00:00 2001
From: avishad verma <avishad.verma@infineon.com>
Date: Wed, 3 Jul 2024 00:58:25 -0500
Subject: [PATCH 271/296] non-upstream: PNO: PNO Code Cleanup

PNO Code cleanup and reuse exsting data structures and defines.

Signed-off-by: avishad verma <avishad.verma@infineon.com>
---
 .../broadcom/brcm80211/brcmfmac/cfg80211.c    |  3 +-
 .../broadcom/brcm80211/brcmfmac/cfg80211.h    |  7 +-
 .../broadcom/brcm80211/brcmfmac/core.c        |  4 +-
 .../broadcom/brcm80211/brcmfmac/pno.c         | 91 ++++++++++---------
 .../broadcom/brcm80211/brcmfmac/pno.h         | 64 +++----------
 .../broadcom/brcm80211/brcmfmac/vendor.c      | 16 ++--
 .../broadcom/brcm80211/brcmfmac/vendor_ifx.c  | 20 ++--
 .../broadcom/brcm80211/brcmfmac/vendor_ifx.h  |  4 +-
 8 files changed, 87 insertions(+), 122 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index dd50568c69de..eeb991157803 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -2833,7 +2833,7 @@ brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev,
 
 	if (cfg->pfn_enable && cfg->pfn_connection) {
 		err = brcmf_fil_cmd_data_set(ifp,
-				BRCMF_C_DISASSOC, NULL, 0);
+					     BRCMF_C_DISASSOC, NULL, 0);
 		if (err) {
 			brcmf_err("BRCMF_C_DISASSOC error:%d\n", err);
 			return -1;
@@ -8049,7 +8049,6 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
 			} else {
 				brcmf_bss_connect_done(cfg, ndev, e, true);
 			}
-			brcmf_bss_connect_done(cfg, ndev, e, true);
 		}
 		brcmf_net_setcarrier(ifp, true);
 	} else if (brcmf_is_linkdown(ifp->vif, e)) {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
index 6be4de07e906..ebcf7317306c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
@@ -12,6 +12,7 @@
 #include "core.h"
 #include "fwil_types.h"
 #include "p2p.h"
+#include "pno.h"
 
 #define BRCMF_SCAN_IE_LEN_MAX		2048
 
@@ -353,11 +354,11 @@ struct brcmf_cfg80211_wowl {
 };
 
 struct network_blob {
-	char ssid[32];
+	char ssid[IEEE80211_MAX_SSID_LEN];
 	u8 ssid_len;
 	int key_mgmt;
-	char psk[64];
-	char sae_password[64];
+	char psk[WSEC_MAX_PASSWORD_LEN];
+	char sae_password[WSEC_MAX_PASSWORD_LEN];
 	u8 proto;
 	u8 pairwise_cipher;
 	u8 frequency;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
index 59bb7cd9373f..724b2646dd95 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
@@ -1868,9 +1868,7 @@ void brcmf_detach(struct device *dev)
 	}
 
 	if (drvr->config) {
-		if (drvr->config->pfn_data.network_blob_data)
-			kfree(drvr->config->pfn_data.network_blob_data);
-
+		kfree(drvr->config->pfn_data.network_blob_data);
 		brcmf_p2p_detach(&drvr->config->p2p);
 		brcmf_cfg80211_detach(drvr->config);
 		drvr->config = NULL;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
index 774dd23c9982..d62395579239 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
@@ -597,46 +597,41 @@ u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi,
 }
 
 int pfn_send_network_blob_fw(struct wiphy *wiphy,
-				struct wireless_dev *wdev)
+			     struct wireless_dev *wdev)
 {
 	int i, ret;
 	struct brcmf_cfg80211_vif *vif;
 	struct brcmf_if *ifp;
 	struct network_blob *network_blob_data;
-	brcm_pfn_param_t pfn_param;
-	struct brcm_pfn *pfn_list_buffer, *pssidnet;
+	struct brcm_pfn_param pfn_param;
+	struct brcm_pfn *pfn_list_buffer = NULL, *pssidnet;
 	int brcm_pfn_length = 0;
-	uint32_t offset;
-
+	u32 offset;
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
+
 	vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev);
 	ifp = vif->ifp;
 
 	brcmf_dbg(TRACE, "Enter\n");
 
 	ret = brcmf_fil_cmd_data_set(vif->ifp,
-					BRCMF_C_DISASSOC, NULL, 0);
+				     BRCMF_C_DISASSOC, NULL, 0);
 	if (ret) {
 		brcmf_err("BRCMF_C_DISASSOC error:%d\n", ret);
-		return -1;
+		return ret;
 	}
 	brcmf_pno_clean(ifp);
 
 	ret = brcmf_fil_iovar_int_set(ifp, "sup_wpa", 1);
 	if (ret) {
 		brcmf_err("sup_wpa set error:%d\n", ret);
-		return -1;
+		return ret;
 	}
 
 	if (!cfg->pfn_data.count)
 		return 0;
 
-	pfn_param.version = PFN_VERSION;
 	pfn_param.flags = (PFN_LIST_ORDER << SORT_CRITERIA_BIT | ENABLE << IMMEDIATE_SCAN_BIT);
-	pfn_param.scan_freq = 30;
-	pfn_param.slow_freq = 0;
-	pfn_param.rssi_margin = 10;
-	pfn_param.lost_network_timeout = 60;
 	pfn_param.bestn = DEFAULT_BESTN;
 	pfn_param.mscan = DEFAULT_MSCAN;
 	pfn_param.repeat = DEFAULT_REPEAT;
@@ -654,23 +649,27 @@ int pfn_send_network_blob_fw(struct wiphy *wiphy,
 		pfn_param.flags |= (PFN_RSSI << SORT_CRITERIA_BIT);
 	}
 
-	pfn_param.version = cpu_to_le32(pfn_param.version);
-	pfn_param.scan_freq = cpu_to_le32(pfn_param.scan_freq);
-	pfn_param.lost_network_timeout = cpu_to_le32(pfn_param.lost_network_timeout);
+	pfn_param.version = cpu_to_le32(PFN_VERSION);
+	pfn_param.scan_freq = cpu_to_le32(30);
+	pfn_param.lost_network_timeout = cpu_to_le32(60);
 	pfn_param.flags = cpu_to_le16(pfn_param.flags);
-	pfn_param.rssi_margin = cpu_to_le16(pfn_param.rssi_margin);
-	pfn_param.slow_freq = cpu_to_le32(pfn_param.slow_freq);
+	pfn_param.rssi_margin = cpu_to_le16(10);
+	pfn_param.slow_freq = cpu_to_le32(0);
 
 	ret = brcmf_fil_iovar_data_set(ifp, "pfn_set", (void *)&pfn_param,
-					sizeof(brcm_pfn_param_t));
+				       sizeof(struct brcm_pfn_param));
 	if (ret) {
 		brcmf_err("set pfn_set enable error:%d\n", ret);
-		return -1;
+		return ret;
 	}
 
 	brcm_pfn_length = (cfg->pfn_data.count) * sizeof(struct brcm_pfn);
 
-	pfn_list_buffer = (struct brcm_pfn *)kzalloc(brcm_pfn_length, GFP_KERNEL);
+	pfn_list_buffer = kzalloc(brcm_pfn_length, GFP_KERNEL);
+
+	if (!pfn_list_buffer)
+		return -ENOMEM;
+
 	pssidnet = pfn_list_buffer;
 	network_blob_data = cfg->pfn_data.network_blob_data;
 
@@ -678,83 +677,85 @@ int pfn_send_network_blob_fw(struct wiphy *wiphy,
 		/* Default setting, open, no WPA, no WEP and bss */
 		pssidnet->auth = WLAN_AUTH_OPEN;
 		pssidnet->wpa_auth = WPA_AUTH_DISABLED;
-		pssidnet->wsec = WPA_CIPHER_NONE;
-		pssidnet->infra = WPAS_MODE_IBSS;
+		pssidnet->wsec = CRYPTO_ALGO_OFF;
+		pssidnet->infra = PFN_SSID_INFRA;
 		pssidnet->flags = 0;
 		memcpy((char *)pssidnet->ssid.SSID, network_blob_data->ssid,
-				network_blob_data->ssid_len);
+		       network_blob_data->ssid_len);
 		pssidnet->ssid.SSID_len = cpu_to_le32(network_blob_data->ssid_len);
 		pssidnet->flags = cpu_to_le32(pssidnet->flags);
 
 		if (strlen(network_blob_data->psk)) {
-			strncpy((char *)pssidnet->psk.key,
-				network_blob_data->psk, WSEC_MAX_PSK_LEN);
+			memcpy((char *)pssidnet->psk.key,
+			       network_blob_data->psk, WSEC_MAX_PASSWORD_LEN);
 			pssidnet->psk.key_len = strlen(network_blob_data->psk);
 		}
 
 		if (network_blob_data->proto == WPA_PROTO_WPA &&
-				network_blob_data->key_mgmt == KEY_MGMT_WPA) {
+		    network_blob_data->key_mgmt == KEY_MGMT_WPA) {
 			pssidnet->wpa_auth = WPA_AUTH_PSK;
 
 		} else if (network_blob_data->proto == WPA_PROTO_RSN &&
-				network_blob_data->key_mgmt == KEY_MGMT_WPA2) {
+			   network_blob_data->key_mgmt == KEY_MGMT_WPA2) {
 			pssidnet->wpa_auth = WPA2_AUTH_PSK;
 
 		} else if (network_blob_data->proto == WPA_PROTO_RSN &&
-				network_blob_data->key_mgmt == KEY_MGMT_SAE) {
+			   network_blob_data->key_mgmt == KEY_MGMT_SAE) {
 			pssidnet->wpa_auth = WPA3_AUTH_SAE_PSK;
 			pssidnet->auth = WLAN_AUTH_SAE;
 
 		} else if (network_blob_data->proto == WPA_PROTO_RSN &&
-				network_blob_data->key_mgmt == KEY_MGMT_OWE) {
+			   network_blob_data->key_mgmt == KEY_MGMT_OWE) {
 			pssidnet->wpa_auth = WPA3_AUTH_OWE;
 		}
 
-		if (network_blob_data->pairwise_cipher == BIT(WPA_CIPHER_AES_CCM))
+		if (network_blob_data->pairwise_cipher == BIT(CRYPTO_ALGO_AES_CCM))
 			pssidnet->wsec = AES_ENABLED;
 
-		else if (network_blob_data->pairwise_cipher == BIT(WPA_CIPHER_TKIP))
+		else if (network_blob_data->pairwise_cipher == BIT(CRYPTO_ALGO_TKIP))
 			pssidnet->wsec = TKIP_ENABLED;
 
 		brcmf_dbg(TRACE, "ssid %s key_mgmt %d proto %d wsec %d wpa_auth %d auth %d\n",
-				network_blob_data->ssid, network_blob_data->key_mgmt,
-				network_blob_data->proto, pssidnet->wsec,
-				pssidnet->wpa_auth, pssidnet->auth);
+			  network_blob_data->ssid, network_blob_data->key_mgmt,
+			  network_blob_data->proto, pssidnet->wsec,
+			  pssidnet->wpa_auth, pssidnet->auth);
 		pssidnet++;
 		network_blob_data++;
 	}
 
 	/* There is a limit in len of data that we can send to fw using an iovar at a time.
 	 * Here max value of cfg->pfn_data.count could be 16 which is exceeding the limit,
-	 * so sending it two times.  */
-	if (cfg->pfn_data.count > (BRCMF_PNO_MAX_PFN_COUNT/2)) {
-		offset = sizeof(struct brcm_pfn) * (BRCMF_PNO_MAX_PFN_COUNT/2);
+	 * so sending it two times.
+	 */
+	if (cfg->pfn_data.count > (BRCMF_PNO_MAX_PFN_COUNT / 2)) {
+		offset = sizeof(struct brcm_pfn) * (BRCMF_PNO_MAX_PFN_COUNT / 2);
 		ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", (void *)pfn_list_buffer,
-						offset);
+					       offset);
 		if (ret) {
 			brcmf_err("set pfnadd enable error:%d\n", ret);
-			return -1;
+			return ret;
 		}
 
 		ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", (void *)pfn_list_buffer + offset,
-						brcm_pfn_length - offset);
+					       brcm_pfn_length - offset);
 		if (ret) {
 			brcmf_err("set pfnadd enable error:%d\n", ret);
-			return -1;
+			return ret;
 		}
 
 	} else {
-		ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", (void *)pfn_list_buffer, brcm_pfn_length);
+		ret = brcmf_fil_iovar_data_set(ifp, "pfn_add", (void *)pfn_list_buffer,
+					       brcm_pfn_length);
 	}
 
 	if (ret) {
 		brcmf_err("set pfnadd enable error:%d\n", ret);
-		return -1;
+		return ret;
 	}
 	ret =  brcmf_fil_iovar_int_set(ifp, "pfn", PFN_SET);
 	if (ret) {
 		brcmf_err("set pfn error:%d\n", ret);
-		return -1;
+		return ret;
 	}
 	kfree(pfn_list_buffer);
 	brcmf_dbg(TRACE, "Exit\n");
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h
index 7d4a2c635247..fb0a59b46856 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.h
@@ -9,20 +9,12 @@
 #define BRCMF_PNO_MAX_PFN_COUNT			16
 #define BRCMF_PNO_SCHED_SCAN_MIN_PERIOD	10
 #define BRCMF_PNO_SCHED_SCAN_MAX_PERIOD	508
-
-#define WPA_CIPHER_NONE                 0       /* None */
-#define WPA_CIPHER_WEP_40               1       /* WEP (40-bit) */
-#define WPA_CIPHER_TKIP                 2       /* TKIP: default for WPA */
-#define WPA_CIPHER_AES_CCM              4       /* AES (CCM) */
-#define WPA_CIPHER_WEP_104              5       /* WEP (104-bit) */
-
 #define AUTO_CONNECT_MASK		0x0010
 #define AUTO_NET_SWITCH_MASK		0x0002
 #define BRCMF_PNO_WPA_AUTH_ANY		0xFFFFFFFF
 #define MAXNUM_SSID_PER_ADD		16
-#define WSEC_MIN_PSK_LEN		8
-#define WSEC_MAX_PSK_LEN		64
-#define DOT11_MAX_SSID_LEN		32      /* d11 max ssid length */
+#define WSEC_MIN_PASSWORD_LEN		8
+#define WSEC_MAX_PASSWORD_LEN		64
 #define PFN_VERSION			2
 #define PFN_LIST_ORDER			0
 #define PFN_RSSI			1
@@ -33,15 +25,10 @@
 #define DEFAULT_MSCAN			0
 #define DEFAULT_REPEAT			10
 #define DEFAULT_EXP			2
-#define WPA_AUTH_DISABLED		0x0000
 #define PFN_SET				1
 #define PFN_UNSET			0
 #define PFN_CONFIG_AND_COUNT_SIZE	2
-#define WLAN_AUTH_OPEN			0
-#define WLAN_AUTH_SHARED_KEY		1
-#define WLAN_AUTH_FT			2
-#define WLAN_AUTH_SAE			3
-
+#define PFN_SSID_INFRA			1
 #define KEY_MGMT_WPA			0x00000001
 #define KEY_MGMT_WPA2			0x00000002
 #define KEY_MGMT_WPA_PSK		0x00000004
@@ -67,7 +54,7 @@
 #define KEY_MGMT_CCKM			0x00400000
 #define KEY_MGMT_OSEN			0x00800000
 
-typedef struct brcm_pfn_param {
+struct brcm_pfn_param {
 	s32 version;
 	s32 scan_freq;
 	s32 lost_network_timeout;
@@ -78,32 +65,21 @@ typedef struct brcm_pfn_param {
 	u8 repeat;
 	u8 exp;
 	s32 slow_freq;
-} brcm_pfn_param_t;
-
-typedef struct wsec_pmk {
-	u16  key_len;
-	u16  flags;
-	u8   key[WSEC_MAX_PSK_LEN];
-} wsec_pmk_t;
-
-typedef struct brcm_ssid {
-	u32          SSID_len;
-	u8           SSID[DOT11_MAX_SSID_LEN];
-} brcm_ssid_t;
+};
 
 struct brcm_pfn {
-	brcm_ssid_t              ssid;                   /**< ssid name and its length */
-	s32                   flags;                  /**< bit2: hidden */
-	s32                   infra;                  /**< BSS Vs IBSS */
-	s32                   auth;                   /**< Open Vs Closed */
-	s32                   wpa_auth;               /**< WPA type */
-	s32                   wsec;                   /**< wsec value */
-	wsec_pmk_t              psk;                    /**< Password */
+	struct brcmf_ssid_le ssid; /*ssid and its length*/
+	s32 flags; /*bit2: hidden*/
+	s32 infra; /*BSS Vs IBSS*/
+	s32 auth; /*Open Vs Closed*/
+	s32 wpa_auth; /*WPA type*/
+	s32 wsec; /*wsec value*/
+	struct brcmf_wsec_pmk_le psk; /*Password*/
 };
 
 struct pfn_conn_info {
 	u8 SSID_len;
-	u8 SSID[32];
+	u8 SSID[IEEE80211_MAX_SSID_LEN];
 	u8 BSSID[ETH_ALEN];
 	s16 RSSI;
 	s8 phy_noise;
@@ -119,15 +95,6 @@ enum {
 	PFN_CONFIG_AUTOSWITCH_RSSI,
 };
 
-enum wpas_mode {
-	WPAS_MODE_INFRA = 0,
-	WPAS_MODE_IBSS = 1,
-	WPAS_MODE_AP = 2,
-	WPAS_MODE_P2P_GO = 3,
-	WPAS_MODE_P2P_GROUP_FORMATION = 4,
-	WPAS_MODE_MESH = 5,
-};
-
 /* forward declaration */
 struct brcmf_pno_info;
 
@@ -187,7 +154,6 @@ u64 brcmf_pno_find_reqid_by_bucket(struct brcmf_pno_info *pi, u32 bucket);
 u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi,
 			     struct brcmf_pno_net_info_le *netinfo);
 
-#endif /* _BRCMF_PNO_H */
-
 int pfn_send_network_blob_fw(struct wiphy *wiphy,
-				struct wireless_dev *wdev);
+			     struct wireless_dev *wdev);
+#endif /* _BRCMF_PNO_H */
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
index 65adad8bd24a..308ea077c576 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c
@@ -359,17 +359,17 @@ const struct wiphy_vendor_command brcmf_vendor_cmds[] = {
 	},
 	{
 		IFX_SUBCMD(PFN_CONFIG,
-				(WIPHY_VENDOR_CMD_NEED_WDEV |
-				 WIPHY_VENDOR_CMD_NEED_NETDEV),
-				VENDOR_CMD_RAW_DATA,
-				ifx_cfg80211_vndr_cmds_config_pfn)
+			   (WIPHY_VENDOR_CMD_NEED_WDEV |
+			   WIPHY_VENDOR_CMD_NEED_NETDEV),
+			   VENDOR_CMD_RAW_DATA,
+			   ifx_cfg80211_vndr_cmds_config_pfn)
 	},
 	{
 		IFX_SUBCMD(PFN_STATUS,
-				(WIPHY_VENDOR_CMD_NEED_WDEV |
-				 WIPHY_VENDOR_CMD_NEED_NETDEV),
-				VENDOR_CMD_RAW_DATA,
-				ifx_cfg80211_vndr_cmds_get_pfn_status)
+			   (WIPHY_VENDOR_CMD_NEED_WDEV |
+			   WIPHY_VENDOR_CMD_NEED_NETDEV),
+			   VENDOR_CMD_RAW_DATA,
+			   ifx_cfg80211_vndr_cmds_get_pfn_status)
 	},
 };
 
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.c
index 9148b1a47c91..6709d81c0ac1 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.c
@@ -1033,15 +1033,15 @@ int ifx_cfg80211_vndr_cmds_str(struct wiphy *wiphy, struct wireless_dev *wdev,
 }
 
 int ifx_cfg80211_vndr_cmds_config_pfn(struct wiphy *wiphy,
-		struct wireless_dev *wdev,
-		const void *data, int len)
+				      struct wireless_dev *wdev,
+				      const void *data, int len)
 {
 	int buflen;
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
 	struct drv_config_pfn_params *pfn_data;
 
 	brcmf_dbg(TRACE, "Enter pfn_enable %d Network_blob count %d\n",
-			cfg->pfn_enable, *((u8 *)data));
+		  cfg->pfn_enable, *((u8 *)data));
 
 	cfg->pfn_enable = 1;
 	pfn_data = (struct drv_config_pfn_params *)data;
@@ -1054,7 +1054,7 @@ int ifx_cfg80211_vndr_cmds_config_pfn(struct wiphy *wiphy,
 	}
 
 	buflen = cfg->pfn_data.count * sizeof(struct network_blob);
-	cfg->pfn_data.network_blob_data = (struct network_blob *)kmalloc(buflen, GFP_KERNEL);
+	cfg->pfn_data.network_blob_data = kmalloc(buflen, GFP_KERNEL);
 	memset(cfg->pfn_data.network_blob_data, '\0', buflen);
 	memcpy(cfg->pfn_data.network_blob_data, (u8 *)data + PFN_CONFIG_AND_COUNT_SIZE, buflen);
 	pfn_send_network_blob_fw(wiphy, wdev);
@@ -1063,8 +1063,8 @@ int ifx_cfg80211_vndr_cmds_config_pfn(struct wiphy *wiphy,
 }
 
 int ifx_cfg80211_vndr_cmds_get_pfn_status(struct wiphy *wiphy,
-					struct wireless_dev *wdev,
-					const void *data, int len)
+					  struct wireless_dev *wdev,
+					  const void *data, int len)
 {
 	struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
 	u8 *buf = NULL;
@@ -1084,15 +1084,15 @@ int ifx_cfg80211_vndr_cmds_get_pfn_status(struct wiphy *wiphy,
 	buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
 	if (!buf) {
 		err = -ENOMEM;
-		return 0;
+		return err;
 	}
 
 	*(u32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
 	err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_BSS_INFO,
-					buf, WL_BSS_INFO_MAX);
+				     buf, WL_BSS_INFO_MAX);
 	if (err) {
 		brcmf_err("pfn_status buf error:%d\n", err);
-		return 0;
+		return err;
 	}
 	bi = (struct brcmf_bss_info_le *)(buf + 4);
 	memset(&curr_bssid, '\0', sizeof(struct pfn_conn_info));
@@ -1120,7 +1120,7 @@ int ifx_cfg80211_vndr_cmds_get_pfn_status(struct wiphy *wiphy,
 	}
 	if (curr_bssid.SSID_len)
 		ifx_cfg80211_vndr_send_cmd_reply(wiphy, (void *)&curr_bssid,
-						sizeof(struct pfn_conn_info));
+						 sizeof(struct pfn_conn_info));
 	kfree(buf);
 	brcmf_dbg(TRACE, "Exit\n");
 	return 0;
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.h
index 092735823d31..55a41cff4044 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor_ifx.h
@@ -795,7 +795,7 @@ int ifx_vndr_cmdstr_tko(struct wiphy *wiphy, struct wireless_dev *wdev,
 int ifx_cfg80211_vndr_cmds_str(struct wiphy *wiphy, struct wireless_dev *wdev,
 			       const void *data, int len);
 int ifx_cfg80211_vndr_cmds_config_pfn(struct wiphy *wiphy,
-				struct wireless_dev *wdev, const void  *data, int len);
+				      struct wireless_dev *wdev, const void  *data, int len);
 int ifx_cfg80211_vndr_cmds_get_pfn_status(struct wiphy *wiphy,
-					struct wireless_dev *wdev, const void  *data, int len);
+					  struct wireless_dev *wdev, const void  *data, int len);
 #endif /* IFX_VENDOR_H */
-- 
2.25.1

