diff mbox series

[-next] block: use DEFINE_MUTEX() for mutex lock

Message ID 20210405101450.15043-1-zhengyongjun3@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] block: use DEFINE_MUTEX() for mutex lock | expand

Commit Message

Zheng Yongjun April 5, 2021, 10:14 a.m. UTC
mutex lock can be initialized automatically with DEFINE_MUTEX()
rather than explicitly calling mutex_init().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
 drivers/block/null_blk/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index d6c821d48090..b15df944cde2 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -67,7 +67,7 @@  struct nullb_page {
 #define NULLB_PAGE_FREE (MAP_SZ - 2)
 
 static LIST_HEAD(nullb_list);
-static struct mutex lock;
+static DEFINE_MUTEX(lock);
 static int null_major;
 static DEFINE_IDA(nullb_indexes);
 static struct blk_mq_tag_set tag_set;
@@ -1961,8 +1961,6 @@  static int __init null_init(void)
 	if (ret)
 		goto err_tagset;
 
-	mutex_init(&lock);
-
 	null_major = register_blkdev(0, "nullb");
 	if (null_major < 0) {
 		ret = null_major;