Skip to contentSkip to conversation

rslib: replace ternary operator with min()

PATCH New [email protected] 1 participant 1 message Oct 25, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rslib: replace ternary operator with min()

Fix the following coccicheck warning:

lib/reed_solomon/test_rslib.c:422: WARNING opportunity for min()

---
 lib/reed_solomon/test_rslib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/reed_solomon/test_rslib.c +1 -1
index 848e7eb5da92..f4a03ae43b86 100644
@@ -419,7 +419,7 @@ static int exercise_rs_bc(struct rs_control *rs, struct wspace *ws,
 		if (eras < 0)
 			eras = 0;
 
-		cutoff = nroots <= len - errs ? nroots : len - errs;
+		cutoff = min(nroots, len - errs);
 		for (; eras <= cutoff; eras++)
 			test_bc(rs, len, errs, eras, trials, &stat, ws);
 	}
Signature · 1 line
2.25.1