aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2015-07-09 16:39:38 -0400
committerStephen Boyd <sboyd@codeaurora.org>2015-07-27 21:13:32 -0400
commit57d866e606ddf2a0cd51f7140cfd8df1fdaa48f6 (patch)
treed416f5f0399391f963b2aa4ffc03d281c3d237ad
parent0817b62cc037a56c5e4238c7eb7522299ea27aef (diff)
clk: fix some determine_rate implementations
Some determine_rate implementations are not returning an error when they failed to adapt the rate according to the rate request. Fix them so that they return an error instead of silently returning 0. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> CC: Jonathan Corbet <corbet@lwn.net> CC: Tony Lindgren <tony@atomide.com> CC: Ralf Baechle <ralf@linux-mips.org> CC: "Emilio López" <emilio@elopez.com.ar> CC: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Tero Kristo <t-kristo@ti.com> CC: Peter De Schrijver <pdeschrijver@nvidia.com> CC: Prashant Gaikwad <pgaikwad@nvidia.com> CC: Stephen Warren <swarren@wwwdotorg.org> CC: Thierry Reding <thierry.reding@gmail.com> CC: Alexandre Courbot <gnurou@gmail.com> CC: linux-doc@vger.kernel.org CC: linux-kernel@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org CC: linux-omap@vger.kernel.org CC: linux-mips@linux-mips.org CC: linux-tegra@vger.kernel.org Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--arch/mips/alchemy/common/clock.c4
-rw-r--r--drivers/clk/clk-composite.c3
-rw-r--r--drivers/clk/clk.c3
-rw-r--r--drivers/clk/hisilicon/clk-hi3620.c2
-rw-r--r--drivers/clk/mmp/clk-mix.c5
-rw-r--r--drivers/clk/sunxi/clk-factors.c6
-rw-r--r--drivers/clk/sunxi/clk-sun6i-ar100.c3
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c6
8 files changed, 24 insertions, 8 deletions
diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
index 0b4cf3e9f005..7cc3eed83a1e 100644
--- a/arch/mips/alchemy/common/clock.c
+++ b/arch/mips/alchemy/common/clock.c
@@ -469,9 +469,13 @@ static int alchemy_clk_fgcs_detr(struct clk_hw *hw,
469 } 469 }
470 } 470 }
471 471
472 if (br < 0)
473 return br;
474
472 req->best_parent_rate = bpr; 475 req->best_parent_rate = bpr;
473 req->best_parent_hw = __clk_get_hw(bpc); 476 req->best_parent_hw = __clk_get_hw(bpc);
474 req->rate = br; 477 req->rate = br;
478
475 return 0; 479 return 0;
476} 480}
477 481
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index 9e69f346ecc6..35ac062d7df6 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -125,8 +125,7 @@ static int clk_composite_determine_rate(struct clk_hw *hw,
125 return mux_ops->determine_rate(mux_hw, req); 125 return mux_ops->determine_rate(mux_hw, req);
126 } else { 126 } else {
127 pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n"); 127 pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n");
128 req->rate = 0; 128 return -EINVAL;
129 return 0;
130 } 129 }
131} 130}
132 131
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 4e9ff928ef88..c907289ff03c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -487,6 +487,9 @@ clk_mux_determine_rate_flags(struct clk_hw *hw, struct clk_rate_request *req,
487 } 487 }
488 } 488 }
489 489
490 if (!best_parent)
491 return -EINVAL;
492
490out: 493out:
491 if (best_parent) 494 if (best_parent)
492 req->best_parent_hw = best_parent->hw; 495 req->best_parent_hw = best_parent->hw;
diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c
index a0674ba6659e..c84ec867a91c 100644
--- a/drivers/clk/hisilicon/clk-hi3620.c
+++ b/drivers/clk/hisilicon/clk-hi3620.c
@@ -316,7 +316,7 @@ static int mmc_clk_determine_rate(struct clk_hw *hw,
316 req->rate = 180000000; 316 req->rate = 180000000;
317 req->best_parent_rate = 1440000000; 317 req->best_parent_rate = 1440000000;
318 } 318 }
319 return 0; 319 return -EINVAL;
320} 320}
321 321
322static u32 mmc_clk_delay(u32 val, u32 para, u32 off, u32 len) 322static u32 mmc_clk_delay(u32 val, u32 para, u32 off, u32 len)
diff --git a/drivers/clk/mmp/clk-mix.c b/drivers/clk/mmp/clk-mix.c
index 7a37432761f9..665cb6794639 100644
--- a/drivers/clk/mmp/clk-mix.c
+++ b/drivers/clk/mmp/clk-mix.c
@@ -218,7 +218,7 @@ static int mmp_clk_mix_determine_rate(struct clk_hw *hw,
218 parent = NULL; 218 parent = NULL;
219 mix_rate_best = 0; 219 mix_rate_best = 0;
220 parent_rate_best = 0; 220 parent_rate_best = 0;
221 gap_best = req->rate; 221 gap_best = ULONG_MAX;
222 parent_best = NULL; 222 parent_best = NULL;
223 223
224 if (mix->table) { 224 if (mix->table) {
@@ -262,6 +262,9 @@ static int mmp_clk_mix_determine_rate(struct clk_hw *hw,
262 } 262 }
263 263
264found: 264found:
265 if (!parent_best)
266 return -EINVAL;
267
265 req->best_parent_rate = parent_rate_best; 268 req->best_parent_rate = parent_rate_best;
266 req->best_parent_hw = __clk_get_hw(parent_best); 269 req->best_parent_hw = __clk_get_hw(parent_best);
267 req->rate = mix_rate_best; 270 req->rate = mix_rate_best;
diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c
index 7a485870991d..94e2570a2409 100644
--- a/drivers/clk/sunxi/clk-factors.c
+++ b/drivers/clk/sunxi/clk-factors.c
@@ -107,8 +107,10 @@ static int clk_factors_determine_rate(struct clk_hw *hw,
107 } 107 }
108 } 108 }
109 109
110 if (best_parent) 110 if (!best_parent)
111 req->best_parent_hw = __clk_get_hw(best_parent); 111 return -EINVAL;
112
113 req->best_parent_hw = __clk_get_hw(best_parent);
112 req->best_parent_rate = best; 114 req->best_parent_rate = best;
113 req->rate = best_child_rate; 115 req->rate = best_child_rate;
114 116
diff --git a/drivers/clk/sunxi/clk-sun6i-ar100.c b/drivers/clk/sunxi/clk-sun6i-ar100.c
index d70c1ea345db..21b076ee59d1 100644
--- a/drivers/clk/sunxi/clk-sun6i-ar100.c
+++ b/drivers/clk/sunxi/clk-sun6i-ar100.c
@@ -105,6 +105,9 @@ static int ar100_determine_rate(struct clk_hw *hw,
105 } 105 }
106 } 106 }
107 107
108 if (best_rate < 0)
109 return best_rate;
110
108 req->rate = best_rate; 111 req->rate = best_rate;
109 112
110 return 0; 113 return 0;
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index d0f72a151bf1..0e15165280dc 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -146,8 +146,10 @@ static int sun6i_ahb1_clk_determine_rate(struct clk_hw *hw,
146 } 146 }
147 } 147 }
148 148
149 if (best_parent) 149 if (!best_parent)
150 req->best_parent_hw = __clk_get_hw(best_parent); 150 return -EINVAL;
151
152 req->best_parent_hw = __clk_get_hw(best_parent);
151 req->best_parent_rate = best; 153 req->best_parent_rate = best;
152 req->rate = best_child_rate; 154 req->rate = best_child_rate;
153 155