Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1516977 > unrolled thread
| Started by | Elaine Zhang <zhangqing@rock-chips.com> |
|---|---|
| First post | 2016-11-08 10:20 +0100 |
| Last post | 2016-11-08 14:30 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] clk: rockchip: validity should be checked prior to clock rate change Elaine Zhang <zhangqing@rock-chips.com> - 2016-11-08 10:20 +0100
Re: [PATCH] clk: rockchip: validity should be checked prior to clock rate change Heiko Stübner <heiko@sntech.de> - 2016-11-08 14:30 +0100
| From | Elaine Zhang <zhangqing@rock-chips.com> |
|---|---|
| Date | 2016-11-08 10:20 +0100 |
| Subject | [PATCH] clk: rockchip: validity should be checked prior to clock rate change |
| Message-ID | <sBaJr-7rN-15@gated-at.bofh.it> |
If validity is not checked prior to clock rate change, clk_set_rate(
cpu_clk, unsupported_rate) will return success, but the real clock rate
change operation is prohibited in post clock change event. Alough post
clock change event will report error due to unsupported clock rate is
set, but this error message is ignored by clock framework.
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
---
drivers/clk/rockchip/clk-cpu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
index 05b3d73bfefa..c4b0cc83fa87 100644
--- a/drivers/clk/rockchip/clk-cpu.c
+++ b/drivers/clk/rockchip/clk-cpu.c
@@ -125,8 +125,17 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
{
const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data;
unsigned long alt_prate, alt_div;
+ const struct rockchip_cpuclk_rate_table *rate;
unsigned long flags;
+ /* check validity of the new rate */
+ rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate);
+ if (!rate) {
+ pr_err("%s: Invalid rate : %lu for cpuclk\n",
+ __func__, ndata->new_rate);
+ return -EINVAL;
+ }
+
alt_prate = clk_get_rate(cpuclk->alt_parent);
spin_lock_irqsave(cpuclk->lock, flags);
--
1.9.1
[toc] | [next] | [standalone]
| From | Heiko Stübner <heiko@sntech.de> |
|---|---|
| Date | 2016-11-08 14:30 +0100 |
| Message-ID | <sBeDo-1rd-23@gated-at.bofh.it> |
| In reply to | #1516977 |
Hi Elaine, Am Dienstag, 8. November 2016, 17:10:14 schrieb Elaine Zhang: > If validity is not checked prior to clock rate change, clk_set_rate( > cpu_clk, unsupported_rate) will return success, but the real clock rate > change operation is prohibited in post clock change event. Alough post > clock change event will report error due to unsupported clock rate is > set, but this error message is ignored by clock framework. > > Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> > Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com> looks good and thanks for catching this. Just a bureaucracy-question regarding the Signed-off-by lines, before I can apply the patch as I don't really know how Rocky fits into the picture. I.e. was he the original patch author (the we should change the from) or a reviewer/tester for the fixed issue? Thanks Heiko
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web