lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1509121936420.2159@localhost6.localdomain6>
Date:	Sat, 12 Sep 2015 19:37:20 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Shraddha Barke <shraddha.6596@...il.com>
cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jes Sorensen <Jes.Sorensen@...hat.com>,
	Julia Lawall <julia.lawall@...6.fr>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] Staging: rtl8188eu: Bool tests don't need
 comparisons



On Sat, 12 Sep 2015, Shraddha Barke wrote:

> This patch removes comparisons to true/false values on bool variables.
> 
> Changes in v3-
>  Fix made manually
> 
> Signed-off-by: Shraddha Barke <shraddha.6596@...il.com>
> ---
>  drivers/staging/rtl8188eu/core/rtw_cmd.c       | 12 +++++------
>  drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 28 +++++++++++++-------------
>  2 files changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> index 001a2f3..591ac5d 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> @@ -272,7 +272,7 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct ndis_802_11_ssid *ssid,
>  	struct cmd_priv		*pcmdpriv = &padapter->cmdpriv;
>  	struct mlme_priv	*pmlmepriv = &padapter->mlmepriv;
>  
> -	if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +	if (check_fwstate(pmlmepriv, _FW_LINKED))
>  		rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
>  
>  	ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
> @@ -903,7 +903,7 @@ static void dynamic_chk_wk_hdl(struct adapter *padapter, u8 *pbuf, int sz)
>  	pmlmepriv = &(padapter->mlmepriv);
>  
>  #ifdef CONFIG_88EU_AP_MODE
> -	if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
> +	if (check_fwstate(pmlmepriv, WIFI_AP_STATE))
>  		expire_timeout_chk(padapter);
>  #endif
>  
> @@ -920,13 +920,13 @@ static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
>  	u8	mstatus;
>  
>  
> -	if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) ||
> -	    (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true))
> +	if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) ||
> +	    (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)))

You don't need to keep the parentheses.

julia

>  		return;
>  
>  	switch (lps_ctrl_type) {
>  	case LPS_CTRL_SCAN:
> -		if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
> +		if (check_fwstate(pmlmepriv, _FW_LINKED)) {
>  			/* connect */
>  			LPS_Leave(padapter);
>  		}
> @@ -1384,7 +1384,7 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter *padapter,  struct cmd_obj *
>  
>  	spin_lock_bh(&pmlmepriv->lock);
>  
> -	if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true))
> +	if ((check_fwstate(pmlmepriv, WIFI_MP_STATE)) && (check_fwstate(pmlmepriv, _FW_UNDER_LINKING)))
>  		_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
>  
>  	set_fwstate(pmlmepriv, _FW_LINKED);
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
> index 22f5b45..64bfefc 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
> @@ -89,7 +89,7 @@ u8 rtw_do_join(struct adapter *padapter)
>  			mod_timer(&pmlmepriv->assoc_timer,
>  				  jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
>  		} else {
> -			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) {
> +			if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
>  				/*  submit createbss_cmd to change to a ADHOC_MASTER */
>  
>  				/* pmlmepriv->lock has been acquired by caller... */
> @@ -162,7 +162,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
>  
>  
>  	DBG_88E("Set BSSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
> -	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> +	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>  		goto handle_tkip_countermeasure;
>  	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
>  		goto release_mlme_lock;
> @@ -171,7 +171,7 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
>  		RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("set_bssid: _FW_LINKED||WIFI_ADHOC_MASTER_STATE\n"));
>  
>  		if (!memcmp(&pmlmepriv->cur_network.network.MacAddress, bssid, ETH_ALEN)) {
> -			if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == false)
> +			if (!check_fwstate(pmlmepriv, WIFI_STATION_STATE))
>  				goto release_mlme_lock;/* it means driver is in WIFI_ADHOC_MASTER_STATE, we needn't create bss again. */
>  		} else {
>  			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_, ("Set BSSID not the same bssid\n"));
> @@ -180,12 +180,12 @@ u8 rtw_set_802_11_bssid(struct adapter *padapter, u8 *bssid)
>  
>  			rtw_disassoc_cmd(padapter, 0, true);
>  
> -			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +			if (check_fwstate(pmlmepriv, _FW_LINKED))
>  				rtw_indicate_disconnect(padapter);
>  
>  			rtw_free_assoc_resources(padapter);
>  
> -			if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true)) {
> +			if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE))) {
>  				_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
>  				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
>  			}
> @@ -248,9 +248,9 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
>  	spin_lock_bh(&pmlmepriv->lock);
>  
>  	DBG_88E("Set SSID under fw_state = 0x%08x\n", get_fwstate(pmlmepriv));
> -	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> +	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>  		goto handle_tkip_countermeasure;
> -	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true)
> +	else if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
>  		goto release_mlme_lock;
>  
>  	if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) {
> @@ -268,12 +268,12 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
>  					/* if in WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE, create bss or rejoin again */
>  					rtw_disassoc_cmd(padapter, 0, true);
>  
> -					if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +					if (check_fwstate(pmlmepriv, _FW_LINKED))
>  						rtw_indicate_disconnect(padapter);
>  
>  					rtw_free_assoc_resources(padapter);
>  
> -					if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
> +					if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
>  						_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
>  						set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
>  					}
> @@ -290,12 +290,12 @@ u8 rtw_set_802_11_ssid(struct adapter *padapter, struct ndis_802_11_ssid *ssid)
>  
>  			rtw_disassoc_cmd(padapter, 0, true);
>  
> -			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +			if (check_fwstate(pmlmepriv, _FW_LINKED))
>  				rtw_indicate_disconnect(padapter);
>  
>  			rtw_free_assoc_resources(padapter);
>  
> -			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) {
> +			if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
>  				_clr_fwstate_(pmlmepriv, WIFI_ADHOC_MASTER_STATE);
>  				set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
>  			}
> @@ -319,7 +319,7 @@ handle_tkip_countermeasure:
>  	memcpy(&pmlmepriv->assoc_ssid, ssid, sizeof(struct ndis_802_11_ssid));
>  	pmlmepriv->assoc_by_bssid = false;
>  
> -	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true)
> +	if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY))
>  		pmlmepriv->to_join = true;
>  	else
>  		status = rtw_do_join(padapter);
> @@ -369,7 +369,7 @@ u8 rtw_set_802_11_infrastructure_mode(struct adapter *padapter,
>  			rtw_free_assoc_resources(padapter);
>  
>  		if ((*pold_state == Ndis802_11Infrastructure) || (*pold_state == Ndis802_11IBSS)) {
> -			if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
> +			if (check_fwstate(pmlmepriv, _FW_LINKED))
>  				rtw_indicate_disconnect(padapter); /* will clr Linked_state; before this function, we must have checked whether  issue dis-assoc_cmd or not */
>  	       }
>  
> @@ -450,7 +450,7 @@ u8 rtw_set_802_11_bssid_list_scan(struct adapter *padapter, struct ndis_802_11_s
>  		res = true;
>  
>  		if (check_fwstate(pmlmepriv,
> -				(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)) == true)
> +				(_FW_UNDER_SURVEY|_FW_UNDER_LINKING)))
>  			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###_FW_UNDER_SURVEY|_FW_UNDER_LINKING\n\n"));
>  		else
>  			RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("\n###pmlmepriv->sitesurveyctrl.traffic_busy == true\n\n"));
> -- 
> 2.1.4
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ