staging: wilc1000: Remove unused variables
PATCH 1/3 staging: wilc1000: Remove unused variables
GCC warns these variables are all set but never used so remove them.
--- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ------ 2 files changed, 18 deletions(-)
drivers/staging/wilc1000/host_interface.c +0 -12
@@ -1432,13 +1432,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif, {s32 result =0 ;u8 msg_type =0 ; -u8 msg_id =0 ; -u16 msg_len =0 ; -u16 wid_id = (u16 )WID_NIL ; -u8 wid_len =0 ;u8 mac_status; -u8 mac_status_reason_code; -u8 mac_status_additional_info;struct host_if_drv *hif_drv = vif->hif_drv;if (!rcvd_info->buffer) {
@@ -1472,13 +1466,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif,return -EFAULT ; } - msg_id = rcvd_info->buffer[1 ]; - msg_len =MAKE_WORD16 (rcvd_info->buffer[2 ], rcvd_info->buffer[3 ]); - wid_id =MAKE_WORD16 (rcvd_info->buffer[4 ], rcvd_info->buffer[5 ]); - wid_len = rcvd_info->buffer[6 ]; mac_status = rcvd_info->buffer[7 ]; - mac_status_reason_code = rcvd_info->buffer[8 ]; - mac_status_additional_info = rcvd_info->buffer[9 ];if (hif_drv->hif_state ==HOST_IF_WAITING_CONN_RESP ) {host_int_parse_assoc_resp_info (vif, mac_status); } else if ((mac_status == MAC_STATUS_DISCONNECTED) &&
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0 -6
@@ -917,12 +917,10 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,const u8 *tx_mic =NULL ;u8 mode =NO_ENCRYPT ;u8 op_mode; -struct wilc *wl;struct wilc_vif *vif; priv =wiphy_priv (wiphy); vif =netdev_priv (netdev); - wl = vif->wilc;switch (params->cipher) {case WLAN_CIPHER_SUITE_WEP40 :
@@ -1885,12 +1883,10 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings) {struct cfg80211_beacon_data *beacon = &settings->beacon; -struct wilc_priv *priv;s32 ret =0 ;struct wilc *wl;struct wilc_vif *vif; - priv =wiphy_priv (wiphy); vif =netdev_priv (dev); wl = vif->wilc;
@@ -2016,14 +2012,12 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) { s32 ret = 0; -struct wilc_priv *priv;struct add_sta_param sta_params = { {0 } };struct wilc_vif *vif;if (!wiphy)return -EFAULT ; - priv =wiphy_priv (wiphy); vif =netdev_priv (dev);if (vif->iftype ==AP_MODE || vif->iftype ==GO_MODE ) {
Signature · 1 line
2.17.0
PATCH 2/3 staging: wilc1000: Remove useless function
GCC warns that 'wid' is unused in wilc_remove_key and it's correct; the variable is only local. Get rid of the function (since it just returns zero) and shuffle the remaining code into one if statement.
--- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/host_interface.h | 1 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++++--------- 3 files changed, 5 insertions(+), 22 deletions(-)
drivers/staging/wilc1000/host_interface.c +0 -12
@@ -2606,18 +2606,6 @@ static void timer_connect_cb(struct timer_list *t)wilc_enqueue_cmd (&msg); } -s32 wilc_remove_key (struct host_if_drv *hif_drv,const u8 *sta_addr) -{ -struct wid wid; - - wid.id = (u16 )WID_REMOVE_KEY ; - wid.type =WID_STR ; - wid.val = (s8 *)sta_addr; - wid.size =6 ; - -return 0 ; -} -int wilc_remove_wep_key (struct wilc_vif *vif,u8 index) {int result =0 ;
drivers/staging/wilc1000/host_interface.h +0 -1
@@ -303,7 +303,6 @@ struct add_sta_param { };struct wilc_vif ; -s32 wilc_remove_key (struct host_if_drv *hif_drv,const u8 *sta_addr);int wilc_remove_wep_key (struct wilc_vif *vif,u8 index);int wilc_set_wep_default_keyid (struct wilc_vif *vif,u8 index); int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +5 -9
@@ -1054,15 +1054,11 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, } } -if (key_index >=0 && key_index <=3 ) { -if (priv->wep_key_len[key_index]) { -memset (priv->wep_key[key_index],0 , - priv->wep_key_len[key_index]); - priv->wep_key_len[key_index] =0 ; -wilc_remove_wep_key (vif, key_index); - } - }else { -wilc_remove_key (priv->hif_drv, mac_addr); +if (key_index >=0 && key_index <=3 && priv->wep_key_len[key_index]) { +memset (priv->wep_key[key_index],0 , + priv->wep_key_len[key_index]); + priv->wep_key_len[key_index] =0 ; +wilc_remove_wep_key (vif, key_index); }return 0 ;
Signature · 1 line
2.17.0
Re: [PATCH 2/3] staging: wilc1000: Remove useless function
Quoted 5 lines · On Sun, 6 May 2018 00:33:32 -0700 Nathan Chancellor <[email protected]>…
GCC warns that 'wid' is unused in
wilc_remove_keyand it's correct; the variable is only local. Get rid of the function (since it just returns zero) and shuffle the remaining code into one if statement.Signed-off-by Nathan Chancellor <[email protected]>
Quoted 60 lines
--- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/host_interface.h | 1 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++++--------- 3 files changed, 5 insertions(+), 22 deletions(-)(quoted diff) +0
-0
b/drivers/staging/wilc1000/host_interface.cindex3fd4c8e62da6..b5f3829e9903100644 ---a/drivers/staging/wilc1000/host_interface.c+++b/drivers/staging/wilc1000/host_interface.c@@ -2606,18 +2606,6 @@ static voidtimer_connect_cb(struct timer_list *t)wilc_enqueue_cmd(&msg); }drivers/staging/wilc1000/host_interface.c +0
-12-s32 wilc_remove_key (struct host_if_drv *hif_drv,const u8 *sta_addr) -{ -struct wid wid; - - wid.id = (u16 )WID_REMOVE_KEY ; - wid.type =WID_STR ; - wid.val = (s8 *)sta_addr; - wid.size =6 ; - -return 0 ; -} -int wilc_remove_wep_key (struct wilc_vif *vif,u8 index) {int result =0 ;(quoted diff) +0
-0
b/drivers/staging/wilc1000/host_interface.hindex7a26f341e0ba..08b3ba7df8b4100644 ---a/drivers/staging/wilc1000/host_interface.h+++b/drivers/staging/wilc1000/host_interface.h@@ -303,7 +303,6 @@ structadd_sta_param{ };struct
wilc_vif;
-s32wilc_remove_key(struct host_if_drv *hif_drv, const u8 *sta_addr);
intwilc_remove_wep_key(struct wilc_vif *vif, u8 index); intwilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index); int wilc_add_wep_key_bss_sta(structwilc_vif*vif, const u8 *key, u8
len, diff --gita/drivers/staging/wilc1000/wilc_wfi_cfgoperations.cb/drivers/staging/wilc1000/wilc_wfi_cfgoperations.cindex76b4afaef423..b499fb987395100644 ---a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c+++b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c@@ -1054,15 +1054,11 @@ static int del_key(struct wiphy *wiphy, structnet_device*netdev, } }drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-9-if (key_index >=0 && key_index <=3 ) { -if (priv->wep_key_len[key_index]) { -memset (priv->wep_key[key_index],0 , - priv->wep_key_len[key_index]); - priv->wep_key_len[key_index] =0 ; -wilc_remove_wep_key (vif, key_index); - } - }else { -wilc_remove_key (priv->hif_drv, mac_addr); + if (key_index >= 0 && key_index <= 3 &&priv->wep_key_len[key_index]) {
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int del_key(struct wiphy *wiphy, struct net_device *netdev, · line 1064
Quoted 7 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +4
-0+memset (priv->wep_key[key_index],0 , + priv->wep_key_len[key_index]); + priv->wep_key_len[key_index] =0 ; +wilc_remove_wep_key (vif, key_index); }return 0 ;
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
PATCH 3/3 staging: wilc1000: Remove unnecessary array index check
In reply to Nathan ChancellorThis statment triggers GCC's -Wtype-limit since key_index is an unsigned integer so it cannot be less than zero.
--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1 -1
@@ -1054,7 +1054,7 @@ static int del_key(struct wiphy *wiphy, struct net_device *netdev, } } -if (key_index >=0 && key_index <=3 && priv->wep_key_len[key_index]) { +if (key_index <=3 && priv->wep_key_len[key_index]) {memset (priv->wep_key[key_index],0 , priv->wep_key_len[key_index]); priv->wep_key_len[key_index] =0 ;
Signature · 6 lines
2.17.0 _______________________________________________ devel mailing list [email protected] http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] staging: wilc1000: Remove unnecessary array index check
Quoted 4 lines · On Sun, 6 May 2018 00:33:33 -0700 Nathan Chancellor <[email protected]>…
This statment triggers GCC's -Wtype-limit since
key_indexis an unsigned integer so it cannot be less than zero.Signed-off-by Nathan Chancellor <[email protected]>
Quoted 14 lines
--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.cindexb499fb987395..e0015ca6c21a100644 ---a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c+++b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c@@ -1054,7 +1054,7 @@ static int del_key(struct wiphy *wiphy, structnet_device*netdev, } }(quoted diff) +0
-1- if (key_index >= 0 && key_index <= 3 &&priv->wep_key_len[key_index]) {
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int del_key(struct wiphy *wiphy, struct net_device *netdev, · line 1060
Quoted 4 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +1
-0+if (key_index <=3 && priv->wep_key_len[key_index]) {memset (priv->wep_key[key_index],0 , priv->wep_key_len[key_index]); priv->wep_key_len[key_index] =0 ;
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Thank you for the patch series.
Quoted 3 lines · On Sun, 6 May 2018 00:33:31 -0700 Nathan Chancellor <[email protected]>…
GCC warns these variables are all set but never used so remove them.
Signed-off-by Nathan Chancellor <[email protected]>
Quoted 74 lines
--- drivers/staging/wilc1000/host_interface.c | 12 ------------ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 ------ 2 files changed, 18 deletions(-)(quoted diff) +0
-0
b/drivers/staging/wilc1000/host_interface.cindex28edd904b33a..3fd4c8e62da6100644 ---a/drivers/staging/wilc1000/host_interface.c+++b/drivers/staging/wilc1000/host_interface.c@@ -1432,13 +1432,7 @@ static s32 handle_rcvd_gnrl_async_info(structwilc_vif*vif, {drivers/staging/wilc1000/host_interface.c +0
-12s32 result =0 ;u8 msg_type =0 ; -u8 msg_id =0 ; -u16 msg_len =0 ; -u16 wid_id = (u16 )WID_NIL ; -u8 wid_len =0 ;u8 mac_status; -u8 mac_status_reason_code; -u8 mac_status_additional_info;struct host_if_drv *hif_drv = vif->hif_drv;if (!rcvd_info->buffer) {@@ -1472,13 +1466,7 @@ static s32 handle_rcvd_gnrl_async_info(struct wilc_vif *vif, return -EFAULT ; } - msg_id = rcvd_info->buffer[1 ]; - msg_len =MAKE_WORD16 (rcvd_info->buffer[2 ], rcvd_info->buffer[3]); - wid_id =MAKE_WORD16 (rcvd_info->buffer[4 ], rcvd_info->buffer[5]); - wid_len = rcvd_info->buffer[6 ]; mac_status = rcvd_info->buffer[7 ]; - mac_status_reason_code = rcvd_info->buffer[8 ]; - mac_status_additional_info = rcvd_info->buffer[9 ];if (hif_drv->hif_state ==HOST_IF_WAITING_CONN_RESP ){
host_int_parse_assoc_resp_info(vif, mac_status);drivers/staging/wilc1000/host_interface.c +0
-0} else if ((mac_status == MAC_STATUS_DISCONNECTED) &&(quoted diff) +0
-0
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.cindex8be3c4c57579..76b4afaef423100644 ---a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c+++b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c@@ -917,12 +917,10 @@ static int add_key(struct wiphy *wiphy, structnet_device*netdev, u8key_index, const u8*tx_mic= NULL; u8 mode =NO_ENCRYPT;drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0
-5u8 op_mode; -struct wilc *wl;struct wilc_vif *vif; priv =wiphy_priv (wiphy); vif =netdev_priv (netdev); - wl = vif->wilc;switch (params->cipher) {case WLAN_CIPHER_SUITE_WEP40 :@@ -1885,12 +1883,10 @@ static int start_ap(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *settings) { struct cfg80211_beacon_data *beacon = &settings->beacon; -struct wilc_priv *priv;s32 ret =0 ;struct wilc *wl;struct wilc_vif *vif; - priv =wiphy_priv (wiphy); vif =netdev_priv (dev); wl = vif->wilc;@@ -2016,14 +2012,12 @@ static int change_station(struct wiphy *wiphy, struct net_device *dev, const u8 *mac, struct station_parameters *params) {s32 ret =0 ; -struct wilc_priv *priv;
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c static int change_station(struct wiphy · line 2023
Quoted 10 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0
-1struct add_sta_param sta_params = { {0 } };struct wilc_vif *vif;if (!wiphy)return -EFAULT ; - priv =wiphy_priv (wiphy); vif =netdev_priv (dev);if (vif->iftype ==AP_MODE || vif->iftype ==GO_MODE ) {
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel