Commit 831475cc authored by Ahmad Fatoum's avatar Ahmad Fatoum Committed by Mike Snitzer

dm crypt: replaced #if defined with IS_ENABLED

IS_ENABLED(CONFIG_ENCRYPTED_KEYS) is true whether the option is built-in
or a module, so use it instead of #if defined checking for each
separately.

The other #if was to avoid a static function defined, but unused
warning. As we now always build the callsite when the function
is defined, we can remove that first #if guard.
Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAhmad Fatoum <a.fatoum@pengutronix.de>
Acked-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 21ec672e
...@@ -2436,7 +2436,6 @@ static int set_key_user(struct crypt_config *cc, struct key *key) ...@@ -2436,7 +2436,6 @@ static int set_key_user(struct crypt_config *cc, struct key *key)
return 0; return 0;
} }
#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE)
static int set_key_encrypted(struct crypt_config *cc, struct key *key) static int set_key_encrypted(struct crypt_config *cc, struct key *key)
{ {
const struct encrypted_key_payload *ekp; const struct encrypted_key_payload *ekp;
...@@ -2452,7 +2451,6 @@ static int set_key_encrypted(struct crypt_config *cc, struct key *key) ...@@ -2452,7 +2451,6 @@ static int set_key_encrypted(struct crypt_config *cc, struct key *key)
return 0; return 0;
} }
#endif /* CONFIG_ENCRYPTED_KEYS */
static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string) static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string)
{ {
...@@ -2482,11 +2480,10 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string ...@@ -2482,11 +2480,10 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
} else if (!strncmp(key_string, "user:", key_desc - key_string + 1)) { } else if (!strncmp(key_string, "user:", key_desc - key_string + 1)) {
type = &key_type_user; type = &key_type_user;
set_key = set_key_user; set_key = set_key_user;
#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE) } else if (IS_ENABLED(CONFIG_ENCRYPTED_KEYS) &&
} else if (!strncmp(key_string, "encrypted:", key_desc - key_string + 1)) { !strncmp(key_string, "encrypted:", key_desc - key_string + 1)) {
type = &key_type_encrypted; type = &key_type_encrypted;
set_key = set_key_encrypted; set_key = set_key_encrypted;
#endif
} else { } else {
return -EINVAL; return -EINVAL;
} }
......
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