diff mbox series

[v2] wifi: brcmfmac: do not pass hidden SSID attribute as value directly

Message ID 20240222122923.46691-1-a@bayrepo.ru (mailing list archive)
State Accepted
Commit 379e5e83f9f9a0d3d3318fee2f363278e7ab08e7
Delegated to: Kalle Valo
Headers show
Series [v2] wifi: brcmfmac: do not pass hidden SSID attribute as value directly | expand

Commit Message

Alexey Berezhok Feb. 22, 2024, 12:29 p.m. UTC
In 'brcmf_cfg80211_start_ap()', not assume that
NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
an explicit check instead.  Use local
variable 'closednet' to pass in function call and
use for error message. Compile tested only.

Addition for the following patch

    commit f20073f50dfd1 ("wifi: brcmfmac: do not cast hidden SSID
                           attribute value to boolean")

Signed-off-by: Alexey Berezhok <a@bayrepo.ru>
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c  | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Arend van Spriel Feb. 22, 2024, 12:39 p.m. UTC | #1
On February 22, 2024 1:29:57 PM Alexey Berezhok <a@bayrepo.ru> wrote:

> In 'brcmf_cfg80211_start_ap()', not assume that
> NL80211_HIDDEN_SSID_NOT_IN_USE is zero but prefer
> an explicit check instead.  Use local
> variable 'closednet' to pass in function call and
> use for error message. Compile tested only.
>
> Addition for the following patch
>
>    commit f20073f50dfd1 ("wifi: brcmfmac: do not cast hidden SSID
>                           attribute value to boolean")

Thanks for the new revision. Although there was a remark about using 
string_choices.h instead of open coding 'val ? "enable" : "disable" ' I 
think that can be done driver wide. Pretty sure the are more instances of 
that. Maybe worth writing a coccinelle patch for that. So for this one...

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Alexey Berezhok <a@bayrepo.ru>
> ---
> .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c  | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Kalle Valo Feb. 27, 2024, 2:56 p.m. UTC | #2
Alexey Berezhok <a@bayrepo.ru> wrote:

> In brcmf_cfg80211_start_ap() do not assume that NL80211_HIDDEN_SSID_NOT_IN_USE
> is zero but prefer an explicit check instead. Use local variable 'closednet'
> to pass in function call and use for error message.
> 
> Compile tested only. Addition for the commit f20073f50dfd1 ("wifi: brcmfmac: do
> not cast hidden SSID attribute value to boolean").
> 
> Signed-off-by: Alexey Berezhok <a@bayrepo.ru>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

Patch applied to wireless-next.git, thanks.

379e5e83f9f9 wifi: brcmfmac: do not pass hidden SSID attribute as value directly
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 63f6e9436..c89307c29 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5099,6 +5099,7 @@  brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
 	bool mbss;
 	int is_11d;
 	bool supports_11d;
+	bool closednet;
 
 	brcmf_dbg(TRACE, "ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n",
 		  settings->chandef.chan->hw_value,
@@ -5268,12 +5269,12 @@  brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev,
 			goto exit;
 		}
 
-		err = brcmf_fil_iovar_int_set(ifp, "closednet",
-					      settings->hidden_ssid);
+		closednet =
+			(settings->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE);
+		err = brcmf_fil_iovar_int_set(ifp, "closednet",	closednet);
 		if (err) {
 			bphy_err(drvr, "%s closednet error (%d)\n",
-				 (settings->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) ?
-				 "enabled" : "disabled",
+				 (closednet ? "enabled" : "disabled"),
 				 err);
 			goto exit;
 		}