提交 45fd6329 编写于 作者: D Dan Carpenter 提交者: Johannes Berg

mac80111: aes_ccm: cleanup ieee80211_aes_key_setup_encrypt()

This code is written using an anti-pattern called "success handling"
which makes it hard to read, especially if you are used to normal kernel
style.  It should instead be written as a list of directives in a row
with branches for error handling.
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 82ca6ef6
...@@ -85,11 +85,15 @@ struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[], ...@@ -85,11 +85,15 @@ struct crypto_aead *ieee80211_aes_key_setup_encrypt(const u8 key[],
return tfm; return tfm;
err = crypto_aead_setkey(tfm, key, key_len); err = crypto_aead_setkey(tfm, key, key_len);
if (!err) if (err)
err = crypto_aead_setauthsize(tfm, mic_len); goto free_aead;
if (!err) err = crypto_aead_setauthsize(tfm, mic_len);
return tfm; if (err)
goto free_aead;
return tfm;
free_aead:
crypto_free_aead(tfm); crypto_free_aead(tfm);
return ERR_PTR(err); return ERR_PTR(err);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册