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>
This commit is contained in:
Andy Shevchenko 2019-07-23 23:41:55 +03:00 committed by Song Liu
parent 7cee6d4e60
commit cf89160793
1 changed files with 1 additions and 5 deletions

View File

@ -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;
}