From a4727801004f255f589478b2d75ec00f0a9e30c5 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 10 Feb 2009 21:25:39 +0100 Subject: [PATCH] zd1211rw: honour enable_beacon conf This makes zd1211rw honour enable_beacon, as well as fixing a memory leak: the beacon skb is leaked when configuring it to the hardware fails. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- drivers/net/wireless/zd1211rw/zd_mac.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 732b69f40978..7579af27edbd 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -768,13 +768,23 @@ static int zd_op_config_interface(struct ieee80211_hw *hw, if (!beacon) return -ENOMEM; r = zd_mac_config_beacon(hw, beacon); - if (r < 0) - return r; - r = zd_set_beacon_interval(&mac->chip, BCN_MODE_IBSS | - hw->conf.beacon_int); - if (r < 0) - return r; kfree_skb(beacon); + + if (r < 0) + return r; + } + + if (conf->changed & IEEE80211_IFCC_BEACON_ENABLED) { + u32 interval; + + if (conf->enable_beacon) + interval = BCN_MODE_IBSS | hw->conf.beacon_int; + else + interval = 0; + + r = zd_set_beacon_interval(&mac->chip, interval); + if (r < 0) + return r; } } else associated = is_valid_ether_addr(conf->bssid);