summaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-10-15 12:58:58 +0200
committerJohannes Berg <johannes.berg@intel.com>2015-10-16 09:15:44 +0200
commit480908a7ec5f2d37d5610b7d9bc48a38f2093876 (patch)
tree2fd754b7644152536f6372842ed899aada0606de /net/wireless/reg.c
parentfd453d3c53eed367f18a0c75bd855cdfc9d6d416 (diff)
downloadlinux-480908a7ec5f2d37d5610b7d9bc48a38f2093876.tar.gz
linux-480908a7ec5f2d37d5610b7d9bc48a38f2093876.tar.bz2
linux-480908a7ec5f2d37d5610b7d9bc48a38f2093876.zip
cfg80211: reg: clarify 'treatment' handling in reg_process_hint()
This function can only deal with treatment values OK and ALREADY_SET so make the callees not return anything else and warn if they do. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 85cad884a6e5..a95fc3abb8e1 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2026,14 +2026,13 @@ reg_process_hint_driver(struct wiphy *wiphy,
break;
case REG_REQ_IGNORE:
reg_free_request(driver_request);
- return treatment;
+ return REG_REQ_OK;
case REG_REQ_INTERSECT:
- /* fall through */
case REG_REQ_ALREADY_SET:
regd = reg_copy_regd(get_cfg80211_regdom());
if (IS_ERR(regd)) {
reg_free_request(driver_request);
- return REG_REQ_IGNORE;
+ return REG_REQ_OK;
}
tmp = get_wiphy_regdom(wiphy);
@@ -2054,7 +2053,7 @@ reg_process_hint_driver(struct wiphy *wiphy,
nl80211_send_reg_change_event(driver_request);
reg_update_last_request(driver_request);
reg_set_request_processed();
- return treatment;
+ return REG_REQ_ALREADY_SET;
}
if (reg_query_database(driver_request))
@@ -2128,10 +2127,10 @@ reg_process_hint_country_ie(struct wiphy *wiphy,
case REG_REQ_OK:
break;
case REG_REQ_IGNORE:
- /* fall through */
+ return REG_REQ_OK;
case REG_REQ_ALREADY_SET:
reg_free_request(country_ie_request);
- return treatment;
+ return REG_REQ_ALREADY_SET;
case REG_REQ_INTERSECT:
reg_free_request(country_ie_request);
/*
@@ -2139,7 +2138,7 @@ reg_process_hint_country_ie(struct wiphy *wiphy,
* ever want to support it for this case.
*/
WARN_ONCE(1, "Unexpected intersection for country IEs");
- return REG_REQ_IGNORE;
+ return REG_REQ_OK;
}
country_ie_request->intersect = false;
@@ -2184,6 +2183,9 @@ static void reg_process_hint(struct regulatory_request *reg_request)
goto out_free;
}
+ WARN(treatment != REG_REQ_OK && treatment != REG_REQ_ALREADY_SET,
+ "unexpected treatment value %d\n", treatment);
+
/* This is required so that the orig_* parameters are saved.
* NOTE: treatment must be set for any case that reaches here!
*/