Skip to content

Commit 91b26a3

Browse files
Li Nanliu-song-6
authored andcommitted
md: return directly before setting did_set_md_closing
There is nothing to do at 'out' before setting 'did_set_md_closing' in md_ioctl(). Return directly, and it will help us to remove 'did_set_md_closing' later. Signed-off-by: Li Nan <[email protected]> Signed-off-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 9dd8702 commit 91b26a3

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

drivers/md/md.c

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7626,26 +7626,19 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
76267626
switch (cmd) {
76277627
case GET_ARRAY_INFO:
76287628
if (!mddev->raid_disks && !mddev->external)
7629-
err = -ENODEV;
7630-
else
7631-
err = get_array_info(mddev, argp);
7632-
goto out;
7629+
return -ENODEV;
7630+
return get_array_info(mddev, argp);
76337631

76347632
case GET_DISK_INFO:
76357633
if (!mddev->raid_disks && !mddev->external)
7636-
err = -ENODEV;
7637-
else
7638-
err = get_disk_info(mddev, argp);
7639-
goto out;
7634+
return -ENODEV;
7635+
return get_disk_info(mddev, argp);
76407636

76417637
case SET_DISK_FAULTY:
7642-
err = set_disk_faulty(mddev, new_decode_dev(arg));
7643-
goto out;
7638+
return set_disk_faulty(mddev, new_decode_dev(arg));
76447639

76457640
case GET_BITMAP_FILE:
7646-
err = get_bitmap_file(mddev, argp);
7647-
goto out;
7648-
7641+
return get_bitmap_file(mddev, argp);
76497642
}
76507643

76517644
if (cmd == HOT_REMOVE_DISK)
@@ -7661,13 +7654,11 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode,
76617654
mutex_lock(&mddev->open_mutex);
76627655
if (mddev->pers && atomic_read(&mddev->openers) > 1) {
76637656
mutex_unlock(&mddev->open_mutex);
7664-
err = -EBUSY;
7665-
goto out;
7657+
return -EBUSY;
76667658
}
76677659
if (test_and_set_bit(MD_CLOSING, &mddev->flags)) {
76687660
mutex_unlock(&mddev->open_mutex);
7669-
err = -EBUSY;
7670-
goto out;
7661+
return -EBUSY;
76717662
}
76727663
did_set_md_closing = true;
76737664
mutex_unlock(&mddev->open_mutex);

0 commit comments

Comments
 (0)