aboutsummaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-07-23 23:41:55 +0300
committerSong Liu <songliubraving@fb.com>2019-08-07 10:25:02 -0700
commitcf89160793c439dca00e2563d0b7f153c274027b (patch)
treef8ec97a9952d2ffe4346772fa79abde4256f1721 /drivers/md
parent7cee6d4e6035603d42acd56d591e624921aa1b14 (diff)
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 <andriy.shevchenko@linux.intel.com> Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 24638ccedce4..3f1252440ad0 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;
}