diff mbox series

ipw2x00: cleanup dead code

Message ID 20181219030013.13736-1-yuehaibing@huawei.com (mailing list archive)
State Accepted
Commit 90a8c74a8d7b0f3fdceadadb155da137e3b157cf
Delegated to: Kalle Valo
Headers show
Series ipw2x00: cleanup dead code | expand

Commit Message

Yue Haibing Dec. 19, 2018, 3 a.m. UTC
Fix smatch warning:

drivers/net/wireless/intel/ipw2x00/ipw2100.c:5606
 shim__set_security() warn: always true condition '(sec->active_key <= 3) => (0-3 <= 3)'
drivers/net/wireless/intel/ipw2x00/ipw2200.c:10725
 shim__set_security() warn: always true condition '(sec->active_key <= 3) => (0-3 <= 3)'

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/net/wireless/intel/ipw2x00/ipw2100.c | 8 ++------
 drivers/net/wireless/intel/ipw2x00/ipw2200.c | 7 ++-----
 2 files changed, 4 insertions(+), 11 deletions(-)

Comments

Kalle Valo Dec. 20, 2018, 6:50 a.m. UTC | #1
YueHaibing <yuehaibing@huawei.com> wrote:

> Fix smatch warning:
> 
> drivers/net/wireless/intel/ipw2x00/ipw2100.c:5606
>  shim__set_security() warn: always true condition '(sec->active_key <= 3) => (0-3 <= 3)'
> drivers/net/wireless/intel/ipw2x00/ipw2200.c:10725
>  shim__set_security() warn: always true condition '(sec->active_key <= 3) => (0-3 <= 3)'
> 
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

Patch applied to wireless-drivers-next.git, thanks.

90a8c74a8d7b ipw2x00: cleanup dead code
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2100.c b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
index 6e31687..52e5ed2 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
@@ -5603,12 +5603,8 @@  static void shim__set_security(struct net_device *dev,
 
 	if ((sec->flags & SEC_ACTIVE_KEY) &&
 	    priv->ieee->sec.active_key != sec->active_key) {
-		if (sec->active_key <= 3) {
-			priv->ieee->sec.active_key = sec->active_key;
-			priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
-		} else
-			priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;
-
+		priv->ieee->sec.active_key = sec->active_key;
+		priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
 		priv->status |= STATUS_SECURITY_UPDATED;
 	}
 
diff --git a/drivers/net/wireless/intel/ipw2x00/ipw2200.c b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
index bbdca13..fa400f9 100644
--- a/drivers/net/wireless/intel/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/intel/ipw2x00/ipw2200.c
@@ -10722,11 +10722,8 @@  static void shim__set_security(struct net_device *dev,
 	}
 
 	if (sec->flags & SEC_ACTIVE_KEY) {
-		if (sec->active_key <= 3) {
-			priv->ieee->sec.active_key = sec->active_key;
-			priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
-		} else
-			priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;
+		priv->ieee->sec.active_key = sec->active_key;
+		priv->ieee->sec.flags |= SEC_ACTIVE_KEY;
 		priv->status |= STATUS_SECURITY_UPDATED;
 	} else
 		priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;