Skip to contentSkip to conversation

staging: rtl8192u: Remove multiple assignments

PATCH In review Gargi Sharma 2 participants 2 messages Mar 11, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8192u: Remove multiple assignments

This patch removes multiple assignments by factorizing them.

This was done with Coccinelle.

@ r1 @
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;

---
 drivers/staging/rtl8192u/r8192U_dm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +4 -2
index 9209aad..ccd19be 100644
@@ -725,8 +725,10 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
 	} else {
 		tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
 
-		if (tmpval >= 6) /* higher temperature */
-			tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
+		if (tmpval >= 6) /* higher temperature */ {
+			tmpOFDMindex = 0;
+			tmpCCK20Mindex = 0;
+		} /* max to +6dB */
 		else
 			tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;
 		tmpCCK40Mindex = 0;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 23 lines · Gargi Sharma

This patch removes multiple assignments by factorizing them.

This was done with Coccinelle.

@ r1 @
identifier i1,i2;
constant c;
@@
- i1=i2=c;
+ i1=c;
+ i2=c;

---
 drivers/staging/rtl8192u/r8192U_dm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8192u/r8192U_dm.c +0 -0
index 9209aad..ccd19be 100644
@@ -725,8 +725,10 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev)
 	} else {

drivers/staging/rtl8192u/r8192U_dm.c static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) · line 733

Quoted 10 lines
drivers/staging/rtl8192u/r8192U_dm.c +4 -2
 		tmpval = (u8)tmpRegA - priv->ThermalMeter[0];
 
-		if (tmpval >= 6) /* higher temperature */
-			tmpOFDMindex = tmpCCK20Mindex = 0; /* max to +6dB */
+		if (tmpval >= 6) /* higher temperature */ {
+			tmpOFDMindex = 0;
+			tmpCCK20Mindex = 0;
+		} /* max to +6dB */
 		else
 			tmpOFDMindex = tmpCCK20Mindex = 6 - tmpval;

This one also has an else branch that you can modify. In any case, the else branch needs {}.

julia

Quoted 11 lines
drivers/staging/rtl8192u/r8192U_dm.c +0 -1
 		tmpCCK40Mindex = 0;
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1489241530-11540-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.