summaryrefslogtreecommitdiff
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-10-02 11:29:54 -0700
committerStephen Boyd <sboyd@codeaurora.org>2015-10-02 11:29:54 -0700
commitc0d625cbb541ae68ca3c97fb62f5f6093d3382fa (patch)
treec67ca474f4fd998829591b50b6f47e58d5b7c8df /lib/string_helpers.c
parent3b4261dcf65993f95de80a0d63c5299aab922bd8 (diff)
parent9f30a04d768f64280dc0c40b730746e82f298d88 (diff)
Merge branch 'clk-fixes' into clk-next
* clk-fixes: (3 commits) clk: ti: dflt: fix enable_reg validity check clk: ti: fix dual-registration of uart4_ick clk: ti: clk-7xx: Remove hardwired ABE clock configuration
Diffstat (limited to 'lib/string_helpers.c')
-rw-r--r--lib/string_helpers.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 54036ce2e2dd..5939f63d90cd 100644
--- a/lib/string_helpers.c
+++ b/lib/string_helpers.c
@@ -59,7 +59,11 @@ void string_get_size(u64 size, u64 blk_size, const enum string_size_units units,
}
exp = divisor[units] / (u32)blk_size;
- if (size >= exp) {
+ /*
+ * size must be strictly greater than exp here to ensure that remainder
+ * is greater than divisor[units] coming out of the if below.
+ */
+ if (size > exp) {
remainder = do_div(size, divisor[units]);
remainder *= blk_size;
i++;