Skip to contentSkip to conversation

drivers/net/wireless/libertas/wext.c: remove dead code

PATCH In review Adrian Bunk 3 participants 3 messages Jul 1, 2007 – Jul 2, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/net/wireless/libertas/wext.c: remove dead code

This patch removes dead code introduced by
commit 90a42210f275e1f828eb6c08bf8252c2d6a774e0 and spotted by the Coverity checker.

---

 drivers/net/wireless/libertas/wext.c |    3 ---
 1 file changed, 3 deletions(-)
drivers/net/wireless/libertas/wext.c renamed from drivers/net/wireless/libertas/wext.c.old +0 -3
@@ -1823,85 +1823,82 @@ static int wlan_set_encodeext(struct net
 	} else if ((alg == IW_ENCODE_ALG_TKIP) || (alg == IW_ENCODE_ALG_CCMP)) {
 		struct WLAN_802_11_KEY * pkey;
 
 		/* validate key length */
 		if (((alg == IW_ENCODE_ALG_TKIP)
 			&& (ext->key_len != KEY_LEN_WPA_TKIP))
 		    || ((alg == IW_ENCODE_ALG_CCMP)
 		        && (ext->key_len != KEY_LEN_WPA_AES))) {
 				lbs_deb_wext("invalid size %d for key of alg"
 				       "type %d\n",
 				       ext->key_len,
 				       alg);
 				ret = -EINVAL;
 				goto out;
 		}
 
 		if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
 			pkey = &assoc_req->wpa_mcast_key;
 			set_bit(ASSOC_FLAG_WPA_MCAST_KEY, &assoc_req->flags);
 		} else {
 			pkey = &assoc_req->wpa_unicast_key;
 			set_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags);
 		}
 
 		memset(pkey, 0, sizeof (struct WLAN_802_11_KEY));
 		memcpy(pkey->key, ext->key, ext->key_len);
 		pkey->len = ext->key_len;
 		if (pkey->len)
 			pkey->flags |= KEY_INFO_WPA_ENABLED;
 
 		/* Do this after zeroing key structure */
 		if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
 			pkey->flags |= KEY_INFO_WPA_MCAST;
 		} else {
 			pkey->flags |= KEY_INFO_WPA_UNICAST;
 		}
 
 		if (alg == IW_ENCODE_ALG_TKIP) {
 			pkey->type = KEY_TYPE_ID_TKIP;
 		} else if (alg == IW_ENCODE_ALG_CCMP) {
 			pkey->type = KEY_TYPE_ID_AES;
-		} else {
-			ret = -EINVAL;
-			goto out;
 		}
 
 		/* If WPA isn't enabled yet, do that now */
 		if (   assoc_req->secinfo.WPAenabled == 0
 		    && assoc_req->secinfo.WPA2enabled == 0) {
 			assoc_req->secinfo.WPAenabled = 1;
 			assoc_req->secinfo.WPA2enabled = 1;
 			set_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags);
 		}
 
 		disable_wep (assoc_req);
 	}
 
 out:
 	if (ret == 0) {
 		wlan_postpone_association_work(priv);
 	} else {
 		wlan_cancel_association_work(priv);
 	}
 	mutex_unlock(&adapter->lock);
 
 	lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
 	return ret;
 }
 
 
 static int wlan_set_genie(struct net_device *dev,
 			  struct iw_request_info *info,
 			  struct iw_point *dwrq,
 			  char *extra)
 {
 	wlan_private *priv = dev->priv;
 	wlan_adapter *adapter = priv->adapter;
 	int ret = 0;
 	struct assoc_request * assoc_req;
 
 	lbs_deb_enter(LBS_DEB_WEXT);
 
 	mutex_lock(&adapter->lock);
 	assoc_req = wlan_get_association_request(adapter);
 	if (!assoc_req) {
maintainer
#1 lore raw

drivers/net/wireless/libertas/wext.c static int wlan_set_encodeext(struct net

Quoted 7 lines · Adrian Bunk

This patch removes dead code introduced by
commit 90a42210f275e1f828eb6c08bf8252c2d6a774e0 and spotted by the Coverity checker.

drivers/net/wireless/libertas/wext.c renamed from drivers/net/wireless/libertas/wext.c.old +0 -0
@@ -1823,85 +1823,82 @@ static int wlan_set_encodeext(struct net

out of curiosity, why so much context?

johannes

#2 lore raw
Quoted 10 lines · On Monday 02 July 2007 10:53:54 Johannes Berg wrote:

drivers/net/wireless/libertas/wext.c static int wlan_set_encodeext(struct net

Quoted 7 lines · Adrian Bunk

This patch removes dead code introduced by
commit 90a42210f275e1f828eb6c08bf8252c2d6a774e0 and spotted by the Coverity checker.

drivers/net/wireless/libertas/wext.c renamed from drivers/net/wireless/libertas/wext.c.old +0 -0
@@ -1823,85 +1823,82 @@ static int wlan_set_encodeext(struct net

out of curiosity, why so much context?

Because you see why it's dead code in the context and don't have to lookup the code tree. ;)

Signature · 1 line
Greetings Michael.