Skip to content

Commit 724fa86

Browse files
Ye Bintyhicks
authored andcommitted
eCryptfs: Use DEFINE_MUTEX() for mutex lock
mutex lock can be initialized automatically with DEFINE_MUTEX() rather than explicitly calling mutex_init(). Reported-by: Hulk Robot <[email protected]> Signed-off-by: Ye Bin <[email protected]> Signed-off-by: Tyler Hicks <[email protected]>
1 parent ffbed07 commit 724fa86

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/ecryptfs/messaging.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
static LIST_HEAD(ecryptfs_msg_ctx_free_list);
1616
static LIST_HEAD(ecryptfs_msg_ctx_alloc_list);
17-
static struct mutex ecryptfs_msg_ctx_lists_mux;
17+
static DEFINE_MUTEX(ecryptfs_msg_ctx_lists_mux);
1818

1919
static struct hlist_head *ecryptfs_daemon_hash;
20-
struct mutex ecryptfs_daemon_hash_mux;
20+
DEFINE_MUTEX(ecryptfs_daemon_hash_mux);
2121
static int ecryptfs_hash_bits;
2222
#define ecryptfs_current_euid_hash(uid) \
2323
hash_long((unsigned long)from_kuid(&init_user_ns, current_euid()), ecryptfs_hash_bits)
@@ -361,7 +361,6 @@ int __init ecryptfs_init_messaging(void)
361361
"too large, defaulting to [%d] users\n", __func__,
362362
ecryptfs_number_of_users);
363363
}
364-
mutex_init(&ecryptfs_daemon_hash_mux);
365364
mutex_lock(&ecryptfs_daemon_hash_mux);
366365
ecryptfs_hash_bits = 1;
367366
while (ecryptfs_number_of_users >> ecryptfs_hash_bits)
@@ -385,7 +384,6 @@ int __init ecryptfs_init_messaging(void)
385384
rc = -ENOMEM;
386385
goto out;
387386
}
388-
mutex_init(&ecryptfs_msg_ctx_lists_mux);
389387
mutex_lock(&ecryptfs_msg_ctx_lists_mux);
390388
ecryptfs_msg_counter = 0;
391389
for (i = 0; i < ecryptfs_message_buf_len; i++) {

0 commit comments

Comments
 (0)