Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751181AbbGAEHo (ORCPT ); Wed, 1 Jul 2015 00:07:44 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33214 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbbGAEHg (ORCPT ); Wed, 1 Jul 2015 00:07:36 -0400 From: Pi-Cheng Chen To: Zhang Rui , Eduardo Valentin Cc: linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] thermal: cpu_cooling: Iterate over all CPUs in clip_cpu mask to get frequency table Date: Wed, 1 Jul 2015 12:07:27 +0800 Message-Id: <1435723647-3354-1-git-send-email-pi-cheng.chen@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1174 Lines: 36 __cpufreq_cooling_register() might fail if some CPU other than first one in clip_cpu mask is present earlier e.g. CPU hotplug. Iterate all CPUs in the mask to handle this case. Signed-off-by: Pi-Cheng Chen --- drivers/thermal/cpu_cooling.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 6509c61..d5e4ea8 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -776,7 +776,13 @@ __cpufreq_cooling_register(struct device_node *np, char dev_name[THERMAL_NAME_LENGTH]; struct cpufreq_frequency_table *pos, *table; unsigned int freq, i, num_cpus; - int ret; + int ret, cpu; + + for_each_cpu(cpu, clip_cpus) { + table = cpufreq_frequency_get_table(cpu); + if (table) + break; + } table = cpufreq_frequency_get_table(cpumask_first(clip_cpus)); if (!table) { -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/