Skip to contentSkip to conversation

Staging: rtl8192: Simplifying if-else statement

PATCH New Ksenija Stanojevic 1 participant 1 message Feb 20, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: rtl8192: Simplifying if-else statement

This patch simplifies the code by not having two identical paths and fixes the warning given by checkpatch.pl: "else is not useful after a break or return".

---
v2: - Change commit message and subject.
- Furthemore simpify the code by placing identical statements (and not just return) after if-else branch.

 drivers/staging/rtl8192u/r819xU_phy.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8192u/r819xU_phy.c +4 -6
index 0589602..e210664 100644
@@ -352,16 +352,14 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath,
 		return 0;
 	if (priv->Rf_Mode == RF_OP_By_FW) {
 		reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr);
-		bitshift =  rtl8192_CalculateBitShift(bitmask);
-		reg = (reg & bitmask) >> bitshift;
 		udelay(200);
-		return reg;
 	} else {
 		reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr);
-		bitshift =  rtl8192_CalculateBitShift(bitmask);
-		reg = (reg & bitmask) >> bitshift;
-		return reg;
 	}
+	bitshift =  rtl8192_CalculateBitShift(bitmask);
+	reg = (reg & bitmask) >> bitshift;
+	return reg;
+
 }
 
 /******************************************************************************
Signature · 1 line
1.9.1