aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_rate.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211_rate.c')
-rw-r--r--net/mac80211/ieee80211_rate.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/mac80211/ieee80211_rate.c b/net/mac80211/ieee80211_rate.c
index 93abb8fff141..e4bd8481554d 100644
--- a/net/mac80211/ieee80211_rate.c
+++ b/net/mac80211/ieee80211_rate.c
@@ -25,6 +25,9 @@ int ieee80211_rate_control_register(struct rate_control_ops *ops)
25{ 25{
26 struct rate_control_alg *alg; 26 struct rate_control_alg *alg;
27 27
28 if (!ops->name)
29 return -EINVAL;
30
28 alg = kzalloc(sizeof(*alg), GFP_KERNEL); 31 alg = kzalloc(sizeof(*alg), GFP_KERNEL);
29 if (alg == NULL) { 32 if (alg == NULL) {
30 return -ENOMEM; 33 return -ENOMEM;
@@ -61,9 +64,12 @@ ieee80211_try_rate_control_ops_get(const char *name)
61 struct rate_control_alg *alg; 64 struct rate_control_alg *alg;
62 struct rate_control_ops *ops = NULL; 65 struct rate_control_ops *ops = NULL;
63 66
67 if (!name)
68 return NULL;
69
64 mutex_lock(&rate_ctrl_mutex); 70 mutex_lock(&rate_ctrl_mutex);
65 list_for_each_entry(alg, &rate_ctrl_algs, list) { 71 list_for_each_entry(alg, &rate_ctrl_algs, list) {
66 if (!name || !strcmp(alg->ops->name, name)) 72 if (!strcmp(alg->ops->name, name))
67 if (try_module_get(alg->ops->module)) { 73 if (try_module_get(alg->ops->module)) {
68 ops = alg->ops; 74 ops = alg->ops;
69 break; 75 break;
@@ -80,9 +86,12 @@ ieee80211_rate_control_ops_get(const char *name)
80{ 86{
81 struct rate_control_ops *ops; 87 struct rate_control_ops *ops;
82 88
89 if (!name)
90 name = "simple";
91
83 ops = ieee80211_try_rate_control_ops_get(name); 92 ops = ieee80211_try_rate_control_ops_get(name);
84 if (!ops) { 93 if (!ops) {
85 request_module("rc80211_%s", name ? name : "default"); 94 request_module("rc80211_%s", name);
86 ops = ieee80211_try_rate_control_ops_get(name); 95 ops = ieee80211_try_rate_control_ops_get(name);
87 } 96 }
88 return ops; 97 return ops;