f2fs crypto: delete an unnecessary check before the function call "key_put"
authorMarkus Elfring <elfring@users.sourceforge.net>
Fri, 26 Jun 2015 15:28:55 +0000 (17:28 +0200)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 4 Aug 2015 21:09:52 +0000 (14:09 -0700)
The key_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/crypto_key.c

index 95b8f936f00b647086b4d8bb61b36295d2e915cc..9f77de2ef317e538ced76d5472c62df4de29fcaf 100644 (file)
@@ -92,8 +92,7 @@ static void f2fs_free_crypt_info(struct f2fs_crypt_info *ci)
        if (!ci)
                return;
 
-       if (ci->ci_keyring_key)
-               key_put(ci->ci_keyring_key);
+       key_put(ci->ci_keyring_key);
        crypto_free_ablkcipher(ci->ci_ctfm);
        kmem_cache_free(f2fs_crypt_info_cachep, ci);
 }