Skip to content

Commit 831475c

Browse files
a3fsnitm
authored andcommitted
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: Arnd Bergmann <[email protected]> Signed-off-by: Ahmad Fatoum <[email protected]> Acked-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 21ec672 commit 831475c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/md/dm-crypt.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,7 +2436,6 @@ static int set_key_user(struct crypt_config *cc, struct key *key)
24362436
return 0;
24372437
}
24382438

2439-
#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE)
24402439
static int set_key_encrypted(struct crypt_config *cc, struct key *key)
24412440
{
24422441
const struct encrypted_key_payload *ekp;
@@ -2452,7 +2451,6 @@ static int set_key_encrypted(struct crypt_config *cc, struct key *key)
24522451

24532452
return 0;
24542453
}
2455-
#endif /* CONFIG_ENCRYPTED_KEYS */
24562454

24572455
static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string)
24582456
{
@@ -2482,11 +2480,10 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
24822480
} else if (!strncmp(key_string, "user:", key_desc - key_string + 1)) {
24832481
type = &key_type_user;
24842482
set_key = set_key_user;
2485-
#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE)
2486-
} else if (!strncmp(key_string, "encrypted:", key_desc - key_string + 1)) {
2483+
} else if (IS_ENABLED(CONFIG_ENCRYPTED_KEYS) &&
2484+
!strncmp(key_string, "encrypted:", key_desc - key_string + 1)) {
24872485
type = &key_type_encrypted;
24882486
set_key = set_key_encrypted;
2489-
#endif
24902487
} else {
24912488
return -EINVAL;
24922489
}

0 commit comments

Comments
 (0)