From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755672AbcEaSND (ORCPT ); Tue, 31 May 2016 14:13:03 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36123 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755398AbcEaSM5 (ORCPT ); Tue, 31 May 2016 14:12:57 -0400 From: Steve Muckle X-Google-Original-From: Steve Muckle Date: Tue, 31 May 2016 11:12:53 -0700 To: Viresh Kumar Cc: Steve Muckle , Peter Zijlstra , Ingo Molnar , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette Subject: Re: [PATCH v2 1/3] cpufreq: add resolve_freq driver callback Message-ID: <20160531181253.GI9864@graphite.smuckle.net> References: <1464231181-30741-1-git-send-email-smuckle@linaro.org> <1464231181-30741-2-git-send-email-smuckle@linaro.org> <20160531111451.GF9463@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160531111451.GF9463@vireshk-i7> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 31, 2016 at 04:44:51PM +0530, Viresh Kumar wrote: > On 25-05-16, 19:52, Steve Muckle wrote: > > +unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, > > + unsigned int target_freq) > > +{ > > + struct cpufreq_frequency_table *freq_table; > > + int index, retval; > > + > > + clamp_val(target_freq, policy->min, policy->max); > > Rafael will kill me for this, as I have fallen into the same trap and > copied your *incorrect* code :( > > This is a useless statement unless you do: > > target_freq = clamp_val(target_freq, policy->min, policy->max); Well I wouldn't worry too much, I copied it from Rafael's code in cpufreq_driver_fast_switch() which also has this problem and needs to be fixed. Perhaps clamp_val could be changed to force the compiler to check that its return value is being used. thanks, Steve