aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rate.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rate.c')
-rw-r--r--net/mac80211/rate.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index ccda7454fb17..b9007f80cb92 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -284,9 +284,16 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
284 struct rate_control_ref *ref, *old; 284 struct rate_control_ref *ref, *old;
285 285
286 ASSERT_RTNL(); 286 ASSERT_RTNL();
287
287 if (local->open_count) 288 if (local->open_count)
288 return -EBUSY; 289 return -EBUSY;
289 290
291 if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) {
292 if (WARN_ON(!local->ops->set_rts_threshold))
293 return -EINVAL;
294 return 0;
295 }
296
290 ref = rate_control_alloc(name, local); 297 ref = rate_control_alloc(name, local);
291 if (!ref) { 298 if (!ref) {
292 printk(KERN_WARNING "%s: Failed to select rate control " 299 printk(KERN_WARNING "%s: Failed to select rate control "
@@ -305,7 +312,6 @@ int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
305 "algorithm '%s'\n", wiphy_name(local->hw.wiphy), 312 "algorithm '%s'\n", wiphy_name(local->hw.wiphy),
306 ref->ops->name); 313 ref->ops->name);
307 314
308
309 return 0; 315 return 0;
310} 316}
311 317
@@ -314,6 +320,10 @@ void rate_control_deinitialize(struct ieee80211_local *local)
314 struct rate_control_ref *ref; 320 struct rate_control_ref *ref;
315 321
316 ref = local->rate_ctrl; 322 ref = local->rate_ctrl;
323
324 if (!ref)
325 return;
326
317 local->rate_ctrl = NULL; 327 local->rate_ctrl = NULL;
318 rate_control_put(ref); 328 rate_control_put(ref);
319} 329}