From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965726AbbJ0Rp6 (ORCPT ); Tue, 27 Oct 2015 13:45:58 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:37157 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964782AbbJ0RdK (ORCPT ); Tue, 27 Oct 2015 13:33:10 -0400 From: =?UTF-8?q?B=C3=A1lint=20Czobor?= To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Todd Poynor , =?UTF-8?q?B=C3=A1lint=20Czobor?= Subject: [PATCH 47/70] cpufreq: interactive: handle errors from cpufreq_frequency_table_target Date: Tue, 27 Oct 2015 18:30:35 +0100 Message-Id: <1445967059-6897-47-git-send-email-czoborbalint@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1445967059-6897-1-git-send-email-czoborbalint@gmail.com> References: <1445967059-6897-1-git-send-email-czoborbalint@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Todd Poynor Add checks for error return from cpufreq_frequency_table_target, and be less noisy on the existing call with an error check. CPU hotplug and system shutdown may cause this call to return -EINVAL. Bug: 8613560 Change-Id: Id78d8829920462c0db1c7e14e717d91740d6cb44 Signed-off-by: Todd Poynor Signed-off-by: Bálint Czobor --- drivers/cpufreq/cpufreq_interactive.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c index baf8740..1b5d930 100644 --- a/drivers/cpufreq/cpufreq_interactive.c +++ b/drivers/cpufreq/cpufreq_interactive.c @@ -246,9 +246,10 @@ static unsigned int choose_freq( * than or equal to the target load. */ - cpufreq_frequency_table_target( - pcpu->policy, pcpu->freq_table, loadadjfreq / tl, - CPUFREQ_RELATION_L, &index); + if (cpufreq_frequency_table_target( + pcpu->policy, pcpu->freq_table, loadadjfreq / tl, + CPUFREQ_RELATION_L, &index)) + break; freq = pcpu->freq_table[index].frequency; if (freq > prevfreq) { @@ -260,10 +261,11 @@ static unsigned int choose_freq( * Find the highest frequency that is less * than freqmax. */ - cpufreq_frequency_table_target( - pcpu->policy, pcpu->freq_table, - freqmax - 1, CPUFREQ_RELATION_H, - &index); + if (cpufreq_frequency_table_target( + pcpu->policy, pcpu->freq_table, + freqmax - 1, CPUFREQ_RELATION_H, + &index)) + break; freq = pcpu->freq_table[index].frequency; if (freq == freqmin) { @@ -286,10 +288,11 @@ static unsigned int choose_freq( * Find the lowest frequency that is higher * than freqmin. */ - cpufreq_frequency_table_target( - pcpu->policy, pcpu->freq_table, - freqmin + 1, CPUFREQ_RELATION_L, - &index); + if (cpufreq_frequency_table_target( + pcpu->policy, pcpu->freq_table, + freqmin + 1, CPUFREQ_RELATION_L, + &index)) + break; freq = pcpu->freq_table[index].frequency; /* @@ -388,11 +391,8 @@ static void cpufreq_interactive_timer(unsigned long data) if (cpufreq_frequency_table_target(pcpu->policy, pcpu->freq_table, new_freq, CPUFREQ_RELATION_L, - &index)) { - pr_warn_once("timer %d: cpufreq_frequency_table_target error\n", - (int) data); + &index)) goto rearm; - } new_freq = pcpu->freq_table[index].frequency; -- 1.7.9.5