Skip to content

Commit

Permalink
md: Convert to use int_pow()
Browse files Browse the repository at this point in the history
Instead of linear approach to calculate power of 10, use generic int_pow()
which does it better.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Song Liu <[email protected]>
  • Loading branch information
andy-shev authored and liu-song-6 committed Aug 7, 2019
1 parent 7cee6d4 commit cf89160
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit cf89160

Please sign in to comment.