[PATCH 5/5] staging: ks7010: fix checkpatch UNNECESSARY_ELSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Checkpatch emits WARNING: else is not generally useful after a break
or return. Two warnings of this type are emitted, both are correct,
'else' statements are unnecessary.

Remove unnecessary 'else' statements, reduce indentation in subsequent
code.

Signed-off-by: Tobin C. Harding <me@xxxxxxxx>
---
 drivers/staging/ks7010/ks_wlan_net.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 20a97a8..4ba11b5 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -202,6 +202,7 @@ static int ks_wlan_set_freq(struct net_device *dev,
 {
 	struct ks_wlan_private *priv =
 	    (struct ks_wlan_private *)netdev_priv(dev);
+	int channel;
 
 	if (priv->sleep_mode == SLP_SLEEP)
 		return -EPERM;
@@ -220,25 +221,23 @@ static int ks_wlan_set_freq(struct net_device *dev,
 		fwrq->m = c + 1;
 	}
 	/* Setting by channel number */
-	if ((fwrq->m > 1000) || (fwrq->e > 0)) {
+	if ((fwrq->m > 1000) || (fwrq->e > 0))
 		return -EOPNOTSUPP;
-	} else {
-		int channel = fwrq->m;
-		/* We should do a better check than that,
-		 * based on the card capability !!!
-		 */
-		if ((channel < 1) || (channel > 14)) {
-			netdev_dbg(dev,
-				   "%s: New channel value of %d is invalid!\n",
-				   dev->name, fwrq->m);
-			return -EINVAL;
-		} else {
-			/* Yes ! We can set it !!! */
-			priv->reg.channel = (u8)(channel);
-			priv->need_commit |= SME_MODE_SET;
-		}
+
+	channel = fwrq->m;
+	/* We should do a better check than that,
+	 * based on the card capability !!!
+	 */
+	if ((channel < 1) || (channel > 14)) {
+		netdev_dbg(dev, "%s: New channel value of %d is invalid!\n",
+			   dev->name, fwrq->m);
+		return -EINVAL;
 	}
 
+	/* Yes ! We can set it !!! */
+	priv->reg.channel = (u8)(channel);
+	priv->need_commit |= SME_MODE_SET;
+
 	return -EINPROGRESS;	/* Call commit handler */
 }
 
-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux