cpufreq: rockchip: fix warning caused by passing invalid cpu id
authorFinley Xiao <finley.xiao@rock-chips.com>
Thu, 18 May 2017 08:28:56 +0000 (16:28 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 19 May 2017 03:35:16 +0000 (11:35 +0800)
------------[ 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 : [<ffffff80088246bc>] lr : [<ffffff80088273b8>]
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 <finley.xiao@rock-chips.com>
drivers/cpufreq/rockchip-cpufreq.c

index 52ac81e2202b67bdbfed99a0a9b572dc1474e596..d4e41ee99670ac97a0eebeb17edf0d8e2bb33e76 100644 (file)
@@ -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);
        }