Commit cf891607 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Song Liu

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent 7cee6d4e
...@@ -3664,11 +3664,7 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale) ...@@ -3664,11 +3664,7 @@ int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale)
return -EINVAL; return -EINVAL;
if (decimals < 0) if (decimals < 0)
decimals = 0; decimals = 0;
while (decimals < scale) { *res = result * int_pow(10, scale - decimals);
result *= 10;
decimals ++;
}
*res = result;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment