From: Andy Shevchenko Date: Tue, 23 Jul 2019 20:41:55 +0000 (+0300) Subject: md: Convert to use int_pow() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cf89160793c439dca00e2563d0b7f153c274027b;p=linux.git md: Convert to use int_pow() Instead of linear approach to calculate power of 10, use generic int_pow() which does it better. Signed-off-by: Andy Shevchenko Signed-off-by: Song Liu --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 24638ccedce42..3f1252440ad08 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3664,11 +3664,7 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale) return -EINVAL; if (decimals < 0) decimals = 0; - while (decimals < scale) { - result *= 10; - decimals ++; - } - *res = result; + *res = result * int_pow(10, scale - decimals); return 0; }