diff options
author | Jonas Gorski <jogo@openwrt.org> | 2015-09-10 10:09:42 +0000 |
---|---|---|
committer | Jonas Gorski <jogo@openwrt.org> | 2015-09-10 10:09:42 +0000 |
commit | 185b399e751025259c671c9a6b4cc41ea6069d79 (patch) | |
tree | 5a63a3eb7f58f7299efcce43219d7133699e1772 /target | |
parent | f0dd60791d99b1fcf7c543ef1cc357addee83313 (diff) | |
download | master-187ad058-185b399e751025259c671c9a6b4cc41ea6069d79.tar.gz master-187ad058-185b399e751025259c671c9a6b4cc41ea6069d79.tar.bz2 master-187ad058-185b399e751025259c671c9a6b4cc41ea6069d79.zip |
ipq806x: fix uninitialized variable usage in cpufreq-krait
In krait_cpufreq_probe, both freq and max_cpu_freq are never
initialized, so the max_cpu_freq will have a random value at the end.
Fix this by properly initializing max_cpu_freq to 0 and storing the clk
frequency in freq as well, to make it similar to how it's calculated in
krait_set_target.
Fixes the following warnings:
In file included from include/linux/clk.h:16:0,
from drivers/cpufreq/cpufreq-krait.c:13:
drivers/cpufreq/cpufreq-krait.c: In function 'krait_cpufreq_probe':
include/linux/kernel.h:714:24: warning: 'freq' may be used uninitialized in this function [-Wmaybe-uninitialized]
_max1 > _max2 ? _max1 : _max2; })
^
drivers/cpufreq/cpufreq-krait.c:217:25: note: 'freq' was declared here
unsigned long freq_Hz, freq, max_cpu_freq;
^
In file included from include/linux/clk.h:16:0,
from drivers/cpufreq/cpufreq-krait.c:13:
include/linux/kernel.h:714:24: warning: 'max_cpu_freq' may be used uninitialized in this function [-Wmaybe-uninitialized]
_max1 > _max2 ? _max1 : _max2; })
^
drivers/cpufreq/cpufreq-krait.c:217:31: note: 'max_cpu_freq' was declared here
unsigned long freq_Hz, freq, max_cpu_freq;
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46839 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ipq806x/patches-3.18/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch | 4 | ||||
-rw-r--r-- | target/linux/ipq806x/patches-4.1/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/target/linux/ipq806x/patches-3.18/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch b/target/linux/ipq806x/patches-3.18/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch index 15cabf3eb9..6052b417ac 100644 --- a/target/linux/ipq806x/patches-3.18/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch +++ b/target/linux/ipq806x/patches-3.18/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch @@ -270,7 +270,7 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> + struct device *dev; + struct clk *clk; + struct regulator *core; -+ unsigned long freq_Hz, freq, max_cpu_freq; ++ unsigned long freq_Hz, freq, max_cpu_freq = 0; + struct dev_pm_opp *opp; + unsigned long volt, tol; + @@ -341,7 +341,7 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> + } + per_cpu(krait_supply_core, cpu) = core; + -+ freq_Hz = clk_get_rate(clk); ++ freq = freq_Hz = clk_get_rate(clk); + + rcu_read_lock(); + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz); diff --git a/target/linux/ipq806x/patches-4.1/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch b/target/linux/ipq806x/patches-4.1/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch index 521adc5c1e..84f856bbf6 100644 --- a/target/linux/ipq806x/patches-4.1/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch +++ b/target/linux/ipq806x/patches-4.1/145-cpufreq-Add-a-cpufreq-krait-based-on-cpufre.patch @@ -270,7 +270,7 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> + struct device *dev; + struct clk *clk; + struct regulator *core; -+ unsigned long freq_Hz, freq, max_cpu_freq; ++ unsigned long freq_Hz, freq, max_cpu_freq = 0; + struct dev_pm_opp *opp; + unsigned long volt, tol; + @@ -341,7 +341,7 @@ Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> + } + per_cpu(krait_supply_core, cpu) = core; + -+ freq_Hz = clk_get_rate(clk); ++ freq = freq_Hz = clk_get_rate(clk); + + rcu_read_lock(); + opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz); |