diff options
| author | Dafna Hirschfeld <[email protected]> | 2018-02-24 12:27:26 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2018-02-26 15:47:40 +0100 |
| commit | ea6430324da47faec9f68da3275628dbdc53d80c (patch) | |
| tree | b0504b023edeaa0ee567062b79a697bfebd06e60 | |
| parent | 3294a9c58ac5f658b423cce78343b19dd1eee61d (diff) | |
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: Dafna Hirschfeld <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
| -rw-r--r-- | drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index 621810d70450..557ab99e6226 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -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); - 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); - - if (params->seq_len > 0) + if (params->seq_len > 0) { 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); + } priv->wilc_ptk[key_index]->cipher = params->cipher; priv->wilc_ptk[key_index]->key_len = params->key_len; |