diff options
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index be708ad8c44d..31a529578805 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -2990,32 +2990,28 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv) | |||
2990 | struct mwifiex_bssdescriptor *curr_bss = | 2990 | struct mwifiex_bssdescriptor *curr_bss = |
2991 | &priv->curr_bss_params.bss_descriptor; | 2991 | &priv->curr_bss_params.bss_descriptor; |
2992 | 2992 | ||
2993 | /* save the beacon buffer if it is not saved or updated */ | 2993 | if (!curr_bss->beacon_buf_size) |
2994 | if ((priv->curr_bcn_buf == NULL) || | 2994 | return; |
2995 | (priv->curr_bcn_size != curr_bss->beacon_buf_size) || | ||
2996 | (memcmp(priv->curr_bcn_buf, curr_bss->beacon_buf, | ||
2997 | curr_bss->beacon_buf_size))) { | ||
2998 | |||
2999 | kfree(priv->curr_bcn_buf); | ||
3000 | priv->curr_bcn_buf = NULL; | ||
3001 | 2995 | ||
2996 | /* allocate beacon buffer at 1st time; or if it's size has changed */ | ||
2997 | if (!priv->curr_bcn_buf || | ||
2998 | priv->curr_bcn_size != curr_bss->beacon_buf_size) { | ||
3002 | priv->curr_bcn_size = curr_bss->beacon_buf_size; | 2999 | priv->curr_bcn_size = curr_bss->beacon_buf_size; |
3003 | if (!priv->curr_bcn_size) | ||
3004 | return; | ||
3005 | 3000 | ||
3001 | kfree(priv->curr_bcn_buf); | ||
3006 | priv->curr_bcn_buf = kzalloc(curr_bss->beacon_buf_size, | 3002 | priv->curr_bcn_buf = kzalloc(curr_bss->beacon_buf_size, |
3007 | GFP_KERNEL); | 3003 | GFP_KERNEL); |
3008 | if (!priv->curr_bcn_buf) { | 3004 | if (!priv->curr_bcn_buf) { |
3009 | dev_err(priv->adapter->dev, | 3005 | dev_err(priv->adapter->dev, |
3010 | "failed to alloc curr_bcn_buf\n"); | 3006 | "failed to alloc curr_bcn_buf\n"); |
3011 | } else { | 3007 | return; |
3012 | memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf, | ||
3013 | curr_bss->beacon_buf_size); | ||
3014 | dev_dbg(priv->adapter->dev, | ||
3015 | "info: current beacon saved %d\n", | ||
3016 | priv->curr_bcn_size); | ||
3017 | } | 3008 | } |
3018 | } | 3009 | } |
3010 | |||
3011 | memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf, | ||
3012 | curr_bss->beacon_buf_size); | ||
3013 | dev_dbg(priv->adapter->dev, "info: current beacon saved %d\n", | ||
3014 | priv->curr_bcn_size); | ||
3019 | } | 3015 | } |
3020 | 3016 | ||
3021 | /* | 3017 | /* |