From a20d636bee41ea67b382207bee216e70f7206752 Mon Sep 17 00:00:00 2001 From: Jackie Liu Date: Thu, 7 Jul 2022 17:08:34 +0800 Subject: raid5: fix duplicate checks for rdev->saved_raid_disk 'first' will always be greater than or equal to 0, it is unnecessary to repeat the 0 check, clean it up. Signed-off-by: Jackie Liu Signed-off-by: Song Liu Signed-off-by: Jens Axboe --- drivers/md/raid5.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 6a6f7d969198..9270a714cceb 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -8263,8 +8263,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) * find the disk ... but prefer rdev->saved_raid_disk * if possible. */ - if (rdev->saved_raid_disk >= 0 && - rdev->saved_raid_disk >= first && + if (rdev->saved_raid_disk >= first && rdev->saved_raid_disk <= last && conf->disks[rdev->saved_raid_disk].rdev == NULL) first = rdev->saved_raid_disk; -- cgit v1.2.1