Skip to content

Commit 480908a

Browse files
committed
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>
1 parent fd453d3 commit 480908a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

net/wireless/reg.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,14 +2026,13 @@ reg_process_hint_driver(struct wiphy *wiphy,
20262026
break;
20272027
case REG_REQ_IGNORE:
20282028
reg_free_request(driver_request);
2029-
return treatment;
2029+
return REG_REQ_OK;
20302030
case REG_REQ_INTERSECT:
2031-
/* fall through */
20322031
case REG_REQ_ALREADY_SET:
20332032
regd = reg_copy_regd(get_cfg80211_regdom());
20342033
if (IS_ERR(regd)) {
20352034
reg_free_request(driver_request);
2036-
return REG_REQ_IGNORE;
2035+
return REG_REQ_OK;
20372036
}
20382037

20392038
tmp = get_wiphy_regdom(wiphy);
@@ -2054,7 +2053,7 @@ reg_process_hint_driver(struct wiphy *wiphy,
20542053
nl80211_send_reg_change_event(driver_request);
20552054
reg_update_last_request(driver_request);
20562055
reg_set_request_processed();
2057-
return treatment;
2056+
return REG_REQ_ALREADY_SET;
20582057
}
20592058

20602059
if (reg_query_database(driver_request))
@@ -2128,18 +2127,18 @@ reg_process_hint_country_ie(struct wiphy *wiphy,
21282127
case REG_REQ_OK:
21292128
break;
21302129
case REG_REQ_IGNORE:
2131-
/* fall through */
2130+
return REG_REQ_OK;
21322131
case REG_REQ_ALREADY_SET:
21332132
reg_free_request(country_ie_request);
2134-
return treatment;
2133+
return REG_REQ_ALREADY_SET;
21352134
case REG_REQ_INTERSECT:
21362135
reg_free_request(country_ie_request);
21372136
/*
21382137
* This doesn't happen yet, not sure we
21392138
* ever want to support it for this case.
21402139
*/
21412140
WARN_ONCE(1, "Unexpected intersection for country IEs");
2142-
return REG_REQ_IGNORE;
2141+
return REG_REQ_OK;
21432142
}
21442143

21452144
country_ie_request->intersect = false;
@@ -2184,6 +2183,9 @@ static void reg_process_hint(struct regulatory_request *reg_request)
21842183
goto out_free;
21852184
}
21862185

2186+
WARN(treatment != REG_REQ_OK && treatment != REG_REQ_ALREADY_SET,
2187+
"unexpected treatment value %d\n", treatment);
2188+
21872189
/* This is required so that the orig_* parameters are saved.
21882190
* NOTE: treatment must be set for any case that reaches here!
21892191
*/

0 commit comments

Comments
 (0)