With the help of Coccinelle, I find some place to use redundant
variable to store the return value, It is unnecessary. Just remove
it and make the funtion to be void.
zhong jiang (3):
brcmsmac: Remove unneeded variable and make function to be void
wlegacy: Remove unneeded variable and make function to be void
libertas: Remove unneeded variable and make function to be void
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c | 5 +----
drivers/net/wireless/intel/iwlegacy/4965-mac.c | 8 ++------
drivers/net/wireless/marvell/libertas/cmd.h | 2 +-
drivers/net/wireless/marvell/libertas/cmdresp.c | 5 +----
4 files changed, 5 insertions(+), 15 deletions(-)
--
1.7.12.4
il4965_set_tkip_dynamic_key_info do not need return value to
cope with different ases. And change functon return type to void.
Signed-off-by: zhong jiang <[email protected]>
---
drivers/net/wireless/intel/iwlegacy/4965-mac.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
index ffb705b..a7bbfe2 100644
--- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
@@ -3326,12 +3326,11 @@ struct il_mod_params il4965_mod_params = {
return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
}
-static int
+static void
il4965_set_tkip_dynamic_key_info(struct il_priv *il,
struct ieee80211_key_conf *keyconf, u8 sta_id)
{
unsigned long flags;
- int ret = 0;
__le16 key_flags = 0;
key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
@@ -3367,8 +3366,6 @@ struct il_mod_params il4965_mod_params = {
memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16);
spin_unlock_irqrestore(&il->sta_lock, flags);
-
- return ret;
}
void
@@ -3483,8 +3480,7 @@ struct il_mod_params il4965_mod_params = {
il4965_set_ccmp_dynamic_key_info(il, keyconf, sta_id);
break;
case WLAN_CIPHER_SUITE_TKIP:
- ret =
- il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
+ il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
break;
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
--
1.7.12.4
zhong jiang <[email protected]> writes:
> il4965_set_tkip_dynamic_key_info do not need return value to
> cope with different ases. And change functon return type to void.
>
> Signed-off-by: zhong jiang <[email protected]>
> ---
> drivers/net/wireless/intel/iwlegacy/4965-mac.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> index ffb705b..a7bbfe2 100644
> --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
> @@ -3326,12 +3326,11 @@ struct il_mod_params il4965_mod_params = {
> return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
> }
>
> -static int
> +static void
> il4965_set_tkip_dynamic_key_info(struct il_priv *il,
> struct ieee80211_key_conf *keyconf, u8 sta_id)
> {
> unsigned long flags;
> - int ret = 0;
> __le16 key_flags = 0;
>
> key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
> @@ -3367,8 +3366,6 @@ struct il_mod_params il4965_mod_params = {
> memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16);
>
> spin_unlock_irqrestore(&il->sta_lock, flags);
> -
> - return ret;
> }
>
> void
> @@ -3483,8 +3480,7 @@ struct il_mod_params il4965_mod_params = {
> il4965_set_ccmp_dynamic_key_info(il, keyconf, sta_id);
> break;
> case WLAN_CIPHER_SUITE_TKIP:
> - ret =
> - il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
> + il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
> break;
> case WLAN_CIPHER_SUITE_WEP40:
> case WLAN_CIPHER_SUITE_WEP104:
To me this looks inconsistent with the rest of the cases in the switch
statement. And won't we then return the ret variable uninitalised?
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
On 2019/9/13 1:45, Kalle Valo wrote:
> zhong jiang <[email protected]> writes:
>
>> il4965_set_tkip_dynamic_key_info do not need return value to
>> cope with different ases. And change functon return type to void.
>>
>> Signed-off-by: zhong jiang <[email protected]>
>> ---
>> drivers/net/wireless/intel/iwlegacy/4965-mac.c | 8 ++------
>> 1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
>> index ffb705b..a7bbfe2 100644
>> --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c
>> +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c
>> @@ -3326,12 +3326,11 @@ struct il_mod_params il4965_mod_params = {
>> return il_send_add_sta(il, &sta_cmd, CMD_SYNC);
>> }
>>
>> -static int
>> +static void
>> il4965_set_tkip_dynamic_key_info(struct il_priv *il,
>> struct ieee80211_key_conf *keyconf, u8 sta_id)
>> {
>> unsigned long flags;
>> - int ret = 0;
>> __le16 key_flags = 0;
>>
>> key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK);
>> @@ -3367,8 +3366,6 @@ struct il_mod_params il4965_mod_params = {
>> memcpy(il->stations[sta_id].sta.key.key, keyconf->key, 16);
>>
>> spin_unlock_irqrestore(&il->sta_lock, flags);
>> -
>> - return ret;
>> }
>>
>> void
>> @@ -3483,8 +3480,7 @@ struct il_mod_params il4965_mod_params = {
>> il4965_set_ccmp_dynamic_key_info(il, keyconf, sta_id);
>> break;
>> case WLAN_CIPHER_SUITE_TKIP:
>> - ret =
>> - il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
>> + il4965_set_tkip_dynamic_key_info(il, keyconf, sta_id);
>> break;
>> case WLAN_CIPHER_SUITE_WEP40:
>> case WLAN_CIPHER_SUITE_WEP104:
> To me this looks inconsistent with the rest of the cases in the switch
> statement. And won't we then return the ret variable uninitalised?
Yep, I miss that. please ignore the patch. Thanks,
Sincerely,
zhong jiang