[PATCH 2/5] md/raid5: use max() in raid5_calc_degraded()
From: Hiroshi Nishida
Date: Wed Jun 24 2026 - 11:56:04 EST
The tail of raid5_calc_degraded() open-codes a max of the two computed
degraded counts. Use max() for clarity.
No functional change.
Assisted-by: Claude:claude-opus-4-8 [Claude Code]
Signed-off-by: Hiroshi Nishida <nishidafmly@xxxxxxxxx>
---
drivers/md/raid5.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 0c5c9fb0606e..2b2aa4f2431c 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -741,9 +741,7 @@ int raid5_calc_degraded(struct r5conf *conf)
if (conf->raid_disks <= conf->previous_raid_disks)
degraded2++;
}
- if (degraded2 > degraded)
- return degraded2;
- return degraded;
+ return max(degraded, degraded2);
}
static bool has_failed(struct r5conf *conf)
--
2.43.0