md: check mddev->pers before calling md_set_readonly()
authorLi Nan <linan122@huawei.com>
Mon, 26 Feb 2024 03:14:44 +0000 (11:14 +0800)
committerSong Liu <song@kernel.org>
Mon, 26 Feb 2024 18:22:22 +0000 (10:22 -0800)
commite9b0a1556ca2e18d67fa6452b2b99aa66b60ba6e
tree3f9d7e4d1c68967138f41e08213cbabf92eac93a
parent650b2e69ff6ab4de8d895e933f2b6fbacb1f8411
md: check mddev->pers before calling md_set_readonly()

If 'mddev->pers' is NULL, there is nothing to do in md_set_readonly().
Except for md_ioctl(), the other two callers of md_set_readonly() have
already checked 'mddev->pers'. To simplify the code, move the check of
'mddev->pers' to the caller.

Signed-off-by: Li Nan <linan122@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240226031444.3606764-10-linan666@huaweicloud.com
drivers/md/md.c