projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7cee6d4
)
md: Convert to use int_pow()
author
Andy Shevchenko
<andriy.shevchenko@linux.intel.com>
Tue, 23 Jul 2019 20:41:55 +0000
(23:41 +0300)
committer
Song Liu
<songliubraving@fb.com>
Wed, 7 Aug 2019 17:25:02 +0000
(10:25 -0700)
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>
drivers/md/md.c
patch
|
blob
|
history
diff --git
a/drivers/md/md.c
b/drivers/md/md.c
index 24638ccedce42b8d9fb346fc7a01ff8622f4c26d..3f1252440ad08882dec7d396b3ca12896b12aa4f 100644
(file)
--- 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;
}