aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
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,
605 return r; 605 return r;
606} 606}
607 607
608/* If rd is not NULL and if this call fails the caller must free it */
609int regulatory_hint(struct wiphy *wiphy, const char *alpha2, 608int regulatory_hint(struct wiphy *wiphy, const char *alpha2,
610 struct ieee80211_regdomain *rd) 609 struct ieee80211_regdomain *rd)
611{ 610{
@@ -690,6 +689,7 @@ void print_regdomain_info(const struct ieee80211_regdomain *rd)
690 print_rd_rules(rd); 689 print_rd_rules(rd);
691} 690}
692 691
692/* Takes ownership of rd only if it doesn't fail */
693static int __set_regdom(const struct ieee80211_regdomain *rd) 693static int __set_regdom(const struct ieee80211_regdomain *rd)
694{ 694{
695 /* Some basic sanity checks first */ 695 /* Some basic sanity checks first */
@@ -750,16 +750,17 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
750 750
751/* Use this call to set the current regulatory domain. Conflicts with 751/* Use this call to set the current regulatory domain. Conflicts with
752 * multiple drivers can be ironed out later. Caller must've already 752 * multiple drivers can be ironed out later. Caller must've already
753 * kmalloc'd the rd structure. If this calls fails you should kfree() 753 * kmalloc'd the rd structure. Caller must hold cfg80211_drv_mutex */
754 * the passed rd. Caller must hold cfg80211_drv_mutex */
755int set_regdom(const struct ieee80211_regdomain *rd) 754int set_regdom(const struct ieee80211_regdomain *rd)
756{ 755{
757 int r; 756 int r;
758 757
759 /* Note that this doesn't update the wiphys, this is done below */ 758 /* Note that this doesn't update the wiphys, this is done below */
760 r = __set_regdom(rd); 759 r = __set_regdom(rd);
761 if (r) 760 if (r) {
761 kfree(rd);
762 return r; 762 return r;
763 }
763 764
764 /* This would make this whole thing pointless */ 765 /* This would make this whole thing pointless */
765 BUG_ON(rd != cfg80211_regdomain); 766 BUG_ON(rd != cfg80211_regdomain);