[PATCH v7 3/9] md: clean up invalid BUG_ON in md_ioctl

From: linan666
Date: Sun Feb 25 2024 - 22:20:55 EST


From: Li Nan <linan122@xxxxxxxxxx>

'disk->private_data' is set to mddev in md_alloc() and never set to NULL,
and users need to open mddev before submitting ioctl. So mddev must not
have been freed during ioctl, and there is no need to check mddev here.
Clean up it.

Signed-off-by: Li Nan <linan122@xxxxxxxxxx>
Reviewed-by: Yu Kuai <yukuai3@xxxxxxxxxx>
---
drivers/md/md.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index b783a64765a7..6432bdbddb1c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7621,11 +7621,6 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,

mddev = bdev->bd_disk->private_data;

- if (!mddev) {
- BUG();
- goto out;
- }
-
/* Some actions do not requires the mutex */
switch (cmd) {
case GET_ARRAY_INFO:
--
2.39.2