aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/clk-vt8500.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/clk/clk-vt8500.c b/drivers/clk/clk-vt8500.c
index 3306c2b1906c..db7d41f25046 100644
--- a/drivers/clk/clk-vt8500.c
+++ b/drivers/clk/clk-vt8500.c
@@ -121,7 +121,12 @@ static long vt8500_dclk_round_rate(struct clk_hw *hw, unsigned long rate,
121 unsigned long *prate) 121 unsigned long *prate)
122{ 122{
123 struct clk_device *cdev = to_clk_device(hw); 123 struct clk_device *cdev = to_clk_device(hw);
124 u32 divisor = *prate / rate; 124 u32 divisor;
125
126 if (rate == 0)
127 return 0;
128
129 divisor = *prate / rate;
125 130
126 /* If prate / rate would be decimal, incr the divisor */ 131 /* If prate / rate would be decimal, incr the divisor */
127 if (rate * divisor < *prate) 132 if (rate * divisor < *prate)
@@ -142,9 +147,14 @@ static int vt8500_dclk_set_rate(struct clk_hw *hw, unsigned long rate,
142 unsigned long parent_rate) 147 unsigned long parent_rate)
143{ 148{
144 struct clk_device *cdev = to_clk_device(hw); 149 struct clk_device *cdev = to_clk_device(hw);
145 u32 divisor = parent_rate / rate; 150 u32 divisor;
146 unsigned long flags = 0; 151 unsigned long flags = 0;
147 152
153 if (rate == 0)
154 return 0;
155
156 divisor = parent_rate / rate;
157
148 /* If prate / rate would be decimal, incr the divisor */ 158 /* If prate / rate would be decimal, incr the divisor */
149 if (rate * divisor < *prate) 159 if (rate * divisor < *prate)
150 divisor++; 160 divisor++;