summaryrefslogtreecommitdiffstats
path: root/drivers/clk/zynqmp
diff options
context:
space:
mode:
authorRajan Vaja <rajan.vaja@xilinx.com>2019-03-04 15:27:46 -0800
committerStephen Boyd <sboyd@kernel.org>2019-04-11 11:31:33 -0700
commit60d74e011c8e7450846563739a8530f823e5d77a (patch)
treeac2d30533dba9b247892f609ba1938965fa28ed9 /drivers/clk/zynqmp
parent9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff)
downloadlinux-60d74e011c8e7450846563739a8530f823e5d77a.tar.bz2
drivers: clk: zynqmp: Allow zero divisor value
Zero divider is valid and default for some of ZynqMP clocks. Allow zero divisor when CLK_DIVIDER_ALLOW_ZERO for the clock is set. Signed-off-by: Rajan Vaja <rajanv@xilinx.com> Signed-off-by: Jolly Shah <jollys@xilinx.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/zynqmp')
-rw-r--r--drivers/clk/zynqmp/divider.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index a371c66e72ef..e146b6fac6b2 100644
--- a/drivers/clk/zynqmp/divider.c
+++ b/drivers/clk/zynqmp/divider.c
@@ -76,6 +76,13 @@ static unsigned long zynqmp_clk_divider_recalc_rate(struct clk_hw *hw,
else
value = div >> 16;
+ if (!value) {
+ WARN(!(divider->flags & CLK_DIVIDER_ALLOW_ZERO),
+ "%s: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set\n",
+ clk_name);
+ return parent_rate;
+ }
+
return DIV_ROUND_UP_ULL(parent_rate, value);
}