projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
039e597
)
clk: shmobile: div6: Avoid division by zero in .round_rate()
author
Geert Uytterhoeven
<geert+renesas@glider.be>
Wed, 4 Feb 2015 12:27:21 +0000
(13:27 +0100)
committer
Michael Turquette
<mturquette@linaro.org>
Wed, 4 Feb 2015 22:02:42 +0000
(14:02 -0800)
Anyone may call clk_round_rate() with a zero rate value, so we have to
protect against that.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
drivers/clk/shmobile/clk-div6.c
patch
|
blob
|
history
diff --git
a/drivers/clk/shmobile/clk-div6.c
b/drivers/clk/shmobile/clk-div6.c
index efbaf6c81b7530b89b52967e087f6e4aa689122b..036a692c72195db93760e40dc1fcb1928b1ecded 100644
(file)
--- a/
drivers/clk/shmobile/clk-div6.c
+++ b/
drivers/clk/shmobile/clk-div6.c
@@
-90,6
+90,9
@@
static unsigned int cpg_div6_clock_calc_div(unsigned long rate,
{
unsigned int div;
+ if (!rate)
+ rate = 1;
+
div = DIV_ROUND_CLOSEST(parent_rate, rate);
return clamp_t(unsigned int, div, 1, 64);
}