diff mbox

[v2] hostapd: remove invalid condition check on vht_oper_chwidth

Message ID 9294a852badcba94279018b5b4ebaea7ac7122a6.1497396033.git.peter.oh@bowerswilkins.com
State Rejected
Headers show

Commit Message

Peter Oh June 13, 2017, 11:21 p.m. UTC
From: Peter Oh <peter.oh@bowerswilkins.com>

vht_oper_chwidth value under the switch - case condition is
already fixed to VHT_CHANWIDTH_80MHZ, so no meaning to inspect
whether vht_oper_chwidth is VHT_CHANWIDTH_80MHZ or not.
Also there is no way that it has VHT_CHANWIDTH_80P80MHZ value
at that point. Hence remove the useless condition check.

Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
---
 src/common/hw_features_common.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Jouni Malinen April 1, 2018, 7:22 p.m. UTC | #1
On Tue, Jun 13, 2017 at 04:21:11PM -0700, peter.oh@bowerswilkins.com wrote:
> vht_oper_chwidth value under the switch - case condition is
> already fixed to VHT_CHANWIDTH_80MHZ, so no meaning to inspect
> whether vht_oper_chwidth is VHT_CHANWIDTH_80MHZ or not.
> Also there is no way that it has VHT_CHANWIDTH_80P80MHZ value
> at that point. Hence remove the useless condition check.

> diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c
> @@ -388,11 +388,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
>  		/* fall through */
>  	case VHT_CHANWIDTH_80MHZ:
>  		data->bandwidth = 80;
> -		if ((vht_oper_chwidth == VHT_CHANWIDTH_80MHZ &&
> -		     center_segment1) ||
> -		    (vht_oper_chwidth == VHT_CHANWIDTH_80P80MHZ &&
> -		     !center_segment1) ||
> -		    !sec_channel_offset)
> +		if (center_segment1 || !sec_channel_offset)

Sorry this got stuck in the queue this long, but please note the "fall
through" comment just above the case VHT_CHANWIDTH_80MHZ line. The fall
through means that vht_oper_chwidth can be VHT_CHANWIDTH_80P80MHZ here.
diff mbox

Patch

diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c
index 7a96f96..1459e97 100644
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -388,11 +388,7 @@  int hostapd_set_freq_params(struct hostapd_freq_params *data,
 		/* fall through */
 	case VHT_CHANWIDTH_80MHZ:
 		data->bandwidth = 80;
-		if ((vht_oper_chwidth == VHT_CHANWIDTH_80MHZ &&
-		     center_segment1) ||
-		    (vht_oper_chwidth == VHT_CHANWIDTH_80P80MHZ &&
-		     !center_segment1) ||
-		    !sec_channel_offset)
+		if (center_segment1 || !sec_channel_offset)
 			return -1;
 		if (!center_segment0) {
 			if (channel <= 48)