Commit ea643032 authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Greg Kroah-Hartman

staging: wilc1000: merge 'if' statements that test the same condition

Merge the instructions of two 'if' statements that test the same
condition and move a 'memcpy' instruction related to a different variable.
Issue found with coccicheck.
Signed-off-by: default avatarDafna Hirschfeld <dafna3@gmail.com>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3294a9c5
...@@ -959,18 +959,14 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index, ...@@ -959,18 +959,14 @@ static int add_key(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
} }
kfree(priv->wilc_ptk[key_index]->key); kfree(priv->wilc_ptk[key_index]->key);
priv->wilc_ptk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL); priv->wilc_ptk[key_index]->key = kmalloc(params->key_len, GFP_KERNEL);
memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len);
kfree(priv->wilc_ptk[key_index]->seq); kfree(priv->wilc_ptk[key_index]->seq);
if (params->seq_len > 0) {
if (params->seq_len > 0)
priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL); priv->wilc_ptk[key_index]->seq = kmalloc(params->seq_len, GFP_KERNEL);
memcpy(priv->wilc_ptk[key_index]->key, params->key, params->key_len);
if (params->seq_len > 0)
memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len); memcpy(priv->wilc_ptk[key_index]->seq, params->seq, params->seq_len);
}
priv->wilc_ptk[key_index]->cipher = params->cipher; priv->wilc_ptk[key_index]->cipher = params->cipher;
priv->wilc_ptk[key_index]->key_len = params->key_len; priv->wilc_ptk[key_index]->key_len = params->key_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment