From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viresh Kumar Subject: Re: [PATCH 24/26] cpu_cooling: Store frequencies in descending order Date: Wed, 3 Dec 2014 10:22:30 +0530 Message-ID: References: <20141202232128.GA3645@developer> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-ob0-f174.google.com ([209.85.214.174]:57375 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751077AbaLCEwb (ORCPT ); Tue, 2 Dec 2014 23:52:31 -0500 Received: by mail-ob0-f174.google.com with SMTP id nt9so4000719obb.19 for ; Tue, 02 Dec 2014 20:52:30 -0800 (PST) In-Reply-To: <20141202232128.GA3645@developer> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Eduardo Valentin Cc: "linux-pm@vger.kernel.org" , Lists linaro-kernel , Zhang Rui On 3 December 2014 at 04:51, Eduardo Valentin wrote: >> +static unsigned int find_next_max(struct cpufreq_frequency_table *table, >> + unsigned int prev_max) >> +{ >> + struct cpufreq_frequency_table *pos; >> + unsigned int max = 0; >> + >> + cpufreq_for_each_valid_entry(pos, table) { >> + if (pos->frequency > max && pos->frequency < prev_max) > > What happens if, for some random reason, the cpufreq table is in > ascending order and this function is called with prev_max == (unsigned > int) -1 ? What would be the returned max? The last frequency of the table, i.e. the max value. What bug did you catch, that I am not able to see..