Skip to content

Commit

Permalink
mac80211: Remove redundant checks for NULL before calls to crypto_fre…
Browse files Browse the repository at this point in the history
…e_cipher()

crypto_free_cipher() is a wrapper around crypto_free_tfm() which is a
wrapper around crypto_destroy_tfm() and the latter can handle being passed
a NULL pointer, so checking for NULL in the
ieee80211_aes_key_free()/ieee80211_aes_cmac_key_free() wrappers around
crypto_free_cipher() is pointless and just increase object code size
needlesly and makes us execute extra test/branch instructions that we
don't need.
Btw; don't we have to many wrappers around wrappers ad nauseam here?
Anyway, this patch removes the redundant conditionals.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Jesper Juhl authored and John W. Linville committed Nov 15, 2010
1 parent 723fc7a commit ffa56e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions net/mac80211/aes_ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,5 @@ struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[])

void ieee80211_aes_key_free(struct crypto_cipher *tfm)
{
if (tfm)
crypto_free_cipher(tfm);
crypto_free_cipher(tfm);
}
3 changes: 1 addition & 2 deletions net/mac80211/aes_cmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,5 @@ struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])

void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm)
{
if (tfm)
crypto_free_cipher(tfm);
crypto_free_cipher(tfm);
}

0 comments on commit ffa56e5

Please sign in to comment.