* [PATCH] wireless: remove superfluous if statement in regulatory code
@ 2015-06-23 18:11 John W. Linville
2015-06-23 18:48 ` Jouni Malinen
0 siblings, 1 reply; 2+ messages in thread
From: John W. Linville @ 2015-06-23 18:11 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, John W. Linville
In reg_process_hint, the test of "treatment == REG_REQ_IGNORE ||
treatment == REG_REQ_ALREADY_SET" is superfluous because the code in the
if-then branch is identical to the code after the if statement.
Coverity CID #1295939
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
net/wireless/reg.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index d359e0610198..fe6b0c6cca10 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2080,9 +2080,6 @@ static void reg_process_hint(struct regulatory_request *reg_request)
return;
case NL80211_REGDOM_SET_BY_USER:
treatment = reg_process_hint_user(reg_request);
- if (treatment == REG_REQ_IGNORE ||
- treatment == REG_REQ_ALREADY_SET)
- return;
return;
case NL80211_REGDOM_SET_BY_DRIVER:
if (!wiphy)
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wireless: remove superfluous if statement in regulatory code
2015-06-23 18:11 [PATCH] wireless: remove superfluous if statement in regulatory code John W. Linville
@ 2015-06-23 18:48 ` Jouni Malinen
0 siblings, 0 replies; 2+ messages in thread
From: Jouni Malinen @ 2015-06-23 18:48 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless, Johannes Berg
On Tue, Jun 23, 2015 at 02:11:06PM -0400, John W. Linville wrote:
> In reg_process_hint, the test of "treatment == REG_REQ_IGNORE ||
> treatment == REG_REQ_ALREADY_SET" is superfluous because the code in the
> if-then branch is identical to the code after the if statement.
This was introduced (or well, left behind) by commit
eeca9fce1d71a4955855ceb0c3b13c1eb9db27c1 ('cfg80211: Schedule timeout
for all CRDA calls'). It could be useful to mention that commit in the
commit message since the resulting code from this new patch looks pretty
strange and that triggered me to take a closer look at what happened
here (looked like this is fine now).
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> @@ -2080,9 +2080,6 @@ static void reg_process_hint(struct regulatory_request *reg_request)
> return;
> case NL80211_REGDOM_SET_BY_USER:
> treatment = reg_process_hint_user(reg_request);
> - if (treatment == REG_REQ_IGNORE ||
> - treatment == REG_REQ_ALREADY_SET)
> - return;
> return;
That assignment of 'treatment' is now write-only and you might as well
remove that while cleaning this up. This being the only caller of
reg_process_hint_user(), even more cleanup could be done by removing
return value from there, but I'm not sure whether that would be of
sufficient benefit.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-23 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 18:11 [PATCH] wireless: remove superfluous if statement in regulatory code John W. Linville
2015-06-23 18:48 ` Jouni Malinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).