diff mbox series

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

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

Commit Message

yebin (H) April 9, 2021, 9:51 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: Ye Bin <yebin10@huawei.com>
---
 drivers/block/pktcdvd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index fc4b0f1aa86d..699ed8bbdbdf 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -96,7 +96,7 @@  static struct proc_dir_entry *pkt_proc;
 static int pktdev_major;
 static int write_congestion_on  = PKT_WRITE_CONGESTION_ON;
 static int write_congestion_off = PKT_WRITE_CONGESTION_OFF;
-static struct mutex ctl_mutex;	/* Serialize open/close/setup/teardown */
+static DEFINE_MUTEX(ctl_mutex);	/* Serialize open/close/setup/teardown */
 static mempool_t psd_pool;
 static struct bio_set pkt_bio_set;
 
@@ -2858,8 +2858,6 @@  static int __init pkt_init(void)
 {
 	int ret;
 
-	mutex_init(&ctl_mutex);
-
 	ret = mempool_init_kmalloc_pool(&psd_pool, PSD_POOL_SIZE,
 				    sizeof(struct packet_stacked_data));
 	if (ret)