Skip to contentSkip to conversation

Staging: rtl8712: Remove useless zero-testing pointer typed value

PATCH New Amitoj Kaur Chawla 1 participant 1 message Apr 1, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8712: Remove useless zero-testing pointer typed value

Removes variable comparison with 0 by using !. Done using following coccinelle script.

@ disable is_zero,isnt_zero @
expression *E;
expression E1,f;
@@

E = f(...)
<...
(
- E == 0
+ !E
|
- E != 0
+ E
|
- 0 == E
+ !E
|
- 0 != E
+ E
)
...>
?E = E1

@ disable is_zero,isnt_zero @
expression *E;
@@

(
E ==
- 0
+ NULL
|
E !=
- 0
+ NULL
|
- 0
+ NULL
== E
|
- 0
+ NULL
!= E
)

---
 drivers/staging/rtl8712/rtl871x_pwrctrl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/rtl871x_pwrctrl.c +2 -2
index aaa5844..32d5a4a 100644
@@ -41,7 +41,7 @@ void r8712_set_rpwm(struct _adapter *padapter, u8 val8)
 	struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv;
 
 	if (pwrpriv->rpwm == val8) {
-		if (pwrpriv->rpwm_retry == 0)
+		if (pwrpriv->rpwm_retry)
 			return;
 	}
 	if ((padapter->bDriverStopped == true) ||
@@ -235,7 +235,7 @@ void r8712_unregister_cmd_alive(struct _adapter *padapter)
 	unregister_task_alive(pwrctrl, CMD_ALIVE);
 	if ((pwrctrl->cpwm > PS_STATE_S2) &&
 	   (pwrctrl->pwr_mode > PS_MODE_ACTIVE)) {
-		if ((pwrctrl->alives == 0) &&
+		if ((pwrctrl->alives) &&
 		    (check_fwstate(&padapter->mlmepriv,
 		     _FW_UNDER_LINKING) != true)) {
 			r8712_set_rpwm(padapter, PS_STATE_S0);
Signature · 1 line
1.9.1