Commit 77834543 authored by Johannes Berg's avatar Johannes Berg Committed by Wey-Yi Guy
Browse files

iwlwifi: clean up some beacon handling



There's no need to check for NULL before
calling dev_kfree_skb() since it is valid
to call it on NULL -- it becomes a no-op.

There's also no need to initialise the
beacon_skb variable to NULL just after
the memory it is in has been kzalloc'ed.

Some minor whitespace cleanups, and a
lock assertion in a function that needs
the mutex (to access the beacon_skb var)
complete the patch.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent 12e934dc
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -317,6 +317,8 @@ static u32 iwl_fill_beacon_frame(struct iwl_priv *priv,
				 struct ieee80211_hdr *hdr,
				 int left)
{
	lockdep_assert_held(&priv->mutex);

	if (!priv->beacon_skb)
		return 0;

@@ -648,12 +650,11 @@ static void iwl_bg_beacon_update(struct work_struct *work)
	/* Pull updated AP beacon from mac80211. will fail if not in AP mode */
	beacon = ieee80211_beacon_get(priv->hw, priv->beacon_ctx->vif);
	if (!beacon) {
		IWL_ERR(priv, "update beacon failed\n");
		IWL_ERR(priv, "update beacon failed -- keeping old\n");
		goto out;
	}

	/* new beacon skb is allocated every time; dispose previous.*/
	if (priv->beacon_skb)
	dev_kfree_skb(priv->beacon_skb);

	priv->beacon_skb = beacon;
@@ -2993,7 +2994,6 @@ static void __iwl_down(struct iwl_priv *priv)
 exit:
	memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp));

	if (priv->beacon_skb)
	dev_kfree_skb(priv->beacon_skb);
	priv->beacon_skb = NULL;

@@ -4131,8 +4131,6 @@ static int iwl_init_drv(struct iwl_priv *priv)
{
	int ret;

	priv->beacon_skb = NULL;

	spin_lock_init(&priv->sta_lock);
	spin_lock_init(&priv->hcmd_lock);

@@ -4645,7 +4643,6 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)

	iwl_free_isr_ict(priv);

	if (priv->beacon_skb)
	dev_kfree_skb(priv->beacon_skb);

	ieee80211_free_hw(priv->hw);