linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wireless: remove unreachable code
@ 2012-09-17 10:54 Alan Cox
  2012-09-17 14:43 ` Joe Perches
  2012-09-17 15:03 ` Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Alan Cox @ 2012-09-17 10:54 UTC (permalink / raw)
  To: johannes, linux-wireless

From: Alan Cox <alan@linux.intel.com>

The only case where intersected_rd can become non NULL is within an if. All
paths from that if return, so the end chunk has therefore squawked its
last and is no more.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 net/wireless/reg.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 1ad04e5..4a405c2 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2305,24 +2305,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
 		return 0;
 	}
 
-	if (!intersected_rd)
-		return -EINVAL;
-
-	rdev = wiphy_to_dev(request_wiphy);
-
-	rdev->country_ie_alpha2[0] = rd->alpha2[0];
-	rdev->country_ie_alpha2[1] = rd->alpha2[1];
-	rdev->env = last_request->country_ie_env;
-
-	BUG_ON(intersected_rd == rd);
-
-	kfree(rd);
-	rd = NULL;
-
-	reset_regdomains(false);
-	cfg80211_regdomain = intersected_rd;
-
-	return 0;
+	return -EINVAL;
 }
 
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wireless: remove unreachable code
  2012-09-17 10:54 [PATCH] wireless: remove unreachable code Alan Cox
@ 2012-09-17 14:43 ` Joe Perches
  2012-09-17 15:03 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2012-09-17 14:43 UTC (permalink / raw)
  To: Alan Cox; +Cc: johannes, linux-wireless

On Mon, 2012-09-17 at 11:54 +0100, Alan Cox wrote:
> From: Alan Cox <alan@linux.intel.com>
> 
> The only case where intersected_rd can become non NULL is within an if. All
> paths from that if return, so the end chunk has therefore squawked its
> last and is no more.

It might be better to move the declaration into the if brace too
---
 net/wireless/reg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 1ad04e5..7985ab2 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2192,7 +2192,6 @@ static void print_regdomain_info(const struct ieee80211_regdomain *rd)
 /* Takes ownership of rd only if it doesn't fail */
 static int __set_regdom(const struct ieee80211_regdomain *rd)
 {
-	const struct ieee80211_regdomain *intersected_rd = NULL;
 	struct cfg80211_registered_device *rdev = NULL;
 	struct wiphy *request_wiphy;
 	/* Some basic sanity checks first */
@@ -2282,6 +2281,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
 	/* Intersection requires a bit more work */
 
 	if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) {
+		const struct ieee80211_regdomain *intersected_rd;
 
 		intersected_rd = regdom_intersect(rd, cfg80211_regdomain);
 		if (!intersected_rd)




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wireless: remove unreachable code
  2012-09-17 10:54 [PATCH] wireless: remove unreachable code Alan Cox
  2012-09-17 14:43 ` Joe Perches
@ 2012-09-17 15:03 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2012-09-17 15:03 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-wireless

On Mon, 2012-09-17 at 11:54 +0100, Alan Cox wrote:
> From: Alan Cox <alan@linux.intel.com>
> 
> The only case where intersected_rd can become non NULL is within an if. All
> paths from that if return, so the end chunk has therefore squawked its
> last and is no more.

Ohh, a BUG_ON() gone, that makes me happy :-)

Applied, thanks.

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-17 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17 10:54 [PATCH] wireless: remove unreachable code Alan Cox
2012-09-17 14:43 ` Joe Perches
2012-09-17 15:03 ` Johannes Berg

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).