2024-01-29 19:08:38

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] wifi: mac80211: clean up FILS discovery change flags handling

From: Johannes Berg <[email protected]>

It doesn't make sense to return BSS change flags in an int, as
they're a bigger type. For this particular function it still
works OK, but clean it up to avoid future errors (or copying
this code in a broken way.)

Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/cfg.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index e006d59087e7..8f647e28e354 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -952,7 +952,8 @@ ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data *sdata,
struct cfg80211_fils_discovery *params,
struct ieee80211_link_data *link,
- struct ieee80211_bss_conf *link_conf)
+ struct ieee80211_bss_conf *link_conf,
+ u64 *changed)
{
struct fils_discovery_data *new, *old = NULL;
struct ieee80211_fils_discovery *fd;
@@ -979,7 +980,8 @@ static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data *sdata,
RCU_INIT_POINTER(link->u.ap.fils_discovery, NULL);
}

- return BSS_CHANGED_FILS_DISCOVERY;
+ *changed |= BSS_CHANGED_FILS_DISCOVERY;
+ return 0;
}

static int
@@ -1441,10 +1443,9 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
goto error;

err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery,
- link, link_conf);
+ link, link_conf, &changed);
if (err < 0)
goto error;
- changed |= err;

err = ieee80211_set_unsol_bcast_probe_resp(sdata,
&params->unsol_bcast_probe_resp,
@@ -1516,10 +1517,9 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
return err;

err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery,
- link, link_conf);
+ link, link_conf, &changed);
if (err < 0)
return err;
- changed |= err;

err = ieee80211_set_unsol_bcast_probe_resp(sdata,
&params->unsol_bcast_probe_resp,
--
2.43.0



2024-02-01 18:31:40

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH] wifi: mac80211: clean up FILS discovery change flags handling

On 1/29/2024 10:57 AM, Johannes Berg wrote:
> From: Johannes Berg <[email protected]>
>
> It doesn't make sense to return BSS change flags in an int, as
> they're a bigger type. For this particular function it still
> works OK, but clean it up to avoid future errors (or copying
> this code in a broken way.)
>
> Signed-off-by: Johannes Berg <[email protected]>

Reviewed-by: Jeff Johnson <[email protected]>

> ---
> net/mac80211/cfg.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index e006d59087e7..8f647e28e354 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -952,7 +952,8 @@ ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
> static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data *sdata,
> struct cfg80211_fils_discovery *params,
> struct ieee80211_link_data *link,
> - struct ieee80211_bss_conf *link_conf)
> + struct ieee80211_bss_conf *link_conf,
> + u64 *changed)
> {
> struct fils_discovery_data *new, *old = NULL;
> struct ieee80211_fils_discovery *fd;
> @@ -979,7 +980,8 @@ static int ieee80211_set_fils_discovery(struct ieee80211_sub_if_data *sdata,
> RCU_INIT_POINTER(link->u.ap.fils_discovery, NULL);
> }
>
> - return BSS_CHANGED_FILS_DISCOVERY;
> + *changed |= BSS_CHANGED_FILS_DISCOVERY;
> + return 0;
> }
>
> static int
> @@ -1441,10 +1443,9 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
> goto error;
>
> err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery,
> - link, link_conf);
> + link, link_conf, &changed);
> if (err < 0)
> goto error;
> - changed |= err;
>
> err = ieee80211_set_unsol_bcast_probe_resp(sdata,
> &params->unsol_bcast_probe_resp,
> @@ -1516,10 +1517,9 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,
> return err;
>
> err = ieee80211_set_fils_discovery(sdata, &params->fils_discovery,
> - link, link_conf);
> + link, link_conf, &changed);
> if (err < 0)
> return err;
> - changed |= err;
>
> err = ieee80211_set_unsol_bcast_probe_resp(sdata,
> &params->unsol_bcast_probe_resp,