From: Finley Xiao Date: Thu, 18 May 2017 08:28:56 +0000 (+0800) Subject: cpufreq: rockchip: fix warning caused by passing invalid cpu id X-Git-Tag: release-20171130_firefly~4^2~544 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=be71a7f386fa3d1959b4a12a5101fc8e13a137c4;p=firefly-linux-kernel-4.4.55.git cpufreq: rockchip: fix warning caused by passing invalid cpu id ------------[ cut here ]------------ [ 105.026874] WARNING: at drivers/cpufreq.c:290 [ 105.026883] Modules linked in: pvrsrvkm(O) [ 105.026900] [ 105.026915] CPU: 0 PID: 1 Comm: init Tainted: G O 4.4.66 #1875 [ 105.026924] Hardware name: Rockchip Sheep board (DT) [ 105.026937] task: ffffffc07b490000 ti: ffffffc07b484000 task.ti: ffffffc07b484000 [ 105.026964] PC is at cpufreq_cpu_get+0x20/0x8c [ 105.026978] LR is at cpufreq_update_policy+0x28/0x130 [ 105.026989] pc : [] lr : [] pstate: 60400145 [ 105.026997] sp : ffffffc07b487a60 [ 105.027004] x29: ffffffc07b487a60 x28: ffffffc07b484000 [ 105.027017] x27: ffffff8008b82000 x26: 000000000000008e [ 105.027028] x25: 000000000000011d x24: 0000000000000001 [ 105.027039] x23: 0000000000000008 x22: 0000000000000008 [ 105.027051] x21: ffffff8009166000 x20: ffffff800923cd50 [ 105.027063] x19: ffffffc07a71c600 x18: 0000000000ffffeb Change-Id: I45de2f755617a5a5903dc5f15e289f8705ceb80d Signed-off-by: Finley Xiao --- diff --git a/drivers/cpufreq/rockchip-cpufreq.c b/drivers/cpufreq/rockchip-cpufreq.c index 52ac81e2202b..d4e41ee99670 100644 --- a/drivers/cpufreq/rockchip-cpufreq.c +++ b/drivers/cpufreq/rockchip-cpufreq.c @@ -353,6 +353,8 @@ static int rockchip_reboot_notifier(struct notifier_block *nb, list_for_each_entry(cluster, &cluster_info_list, list_head) { cpu = cpumask_first_and(&cluster->cpus, cpu_online_mask); + if (cpu >= nr_cpu_ids) + continue; cluster->rebooting = true; cpufreq_update_policy(cpu); }