summaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-24 20:32:20 +0200
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:02:30 -0400
commitd2372b315289aec9f565a855023c40654a5bff68 (patch)
treecfc73e74dfdea854dd27b747d68224076d8e8d90 /net/wireless/reg.c
parent7dddaf1a36a372c14ca96a0b5fdfbe2015c43841 (diff)
downloadtalos-obmc-linux-d2372b315289aec9f565a855023c40654a5bff68.tar.gz
talos-obmc-linux-d2372b315289aec9f565a855023c40654a5bff68.zip
wireless: make regdom passing semantics simpler
The regdom struct is given to the core, so it might as well free it in error conditions. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 00c326b66c03..038f8f133c54 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -605,7 +605,6 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
return r;
}
-/* If rd is not NULL and if this call fails the caller must free it */
int regulatory_hint(struct wiphy *wiphy, const char *alpha2,
struct ieee80211_regdomain *rd)
{
@@ -690,6 +689,7 @@ void print_regdomain_info(const struct ieee80211_regdomain *rd)
print_rd_rules(rd);
}
+/* Takes ownership of rd only if it doesn't fail */
static int __set_regdom(const struct ieee80211_regdomain *rd)
{
/* Some basic sanity checks first */
@@ -750,16 +750,17 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
/* Use this call to set the current regulatory domain. Conflicts with
* multiple drivers can be ironed out later. Caller must've already
- * kmalloc'd the rd structure. If this calls fails you should kfree()
- * the passed rd. Caller must hold cfg80211_drv_mutex */
+ * kmalloc'd the rd structure. Caller must hold cfg80211_drv_mutex */
int set_regdom(const struct ieee80211_regdomain *rd)
{
int r;
/* Note that this doesn't update the wiphys, this is done below */
r = __set_regdom(rd);
- if (r)
+ if (r) {
+ kfree(rd);
return r;
+ }
/* This would make this whole thing pointless */
BUG_ON(rd != cfg80211_regdomain);
OpenPOWER on IntegriCloud