Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752387AbbG2LBx (ORCPT ); Wed, 29 Jul 2015 07:01:53 -0400 Received: from mail-pd0-f180.google.com ([209.85.192.180]:34336 "EHLO mail-pd0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbbG2LBw (ORCPT ); Wed, 29 Jul 2015 07:01:52 -0400 Date: Wed, 29 Jul 2015 16:31:46 +0530 From: Viresh Kumar To: Pan Xinhui Cc: "Rafael J. Wysocki" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "mnipxh@163.com" , "yanmin_zhang@linux.intel.com" Subject: Re: [PATCH] cpufreq: Add scaling frequency range support Message-ID: <20150729110146.GB5100@linux> References: <55B6F7C3.8040405@intel.com> <20150728042945.GE1229@linux> <55B70ACD.9010402@intel.com> <15808229.KgKF05ecju@vostro.rjw.lan> <55B8A3F2.8030809@intel.com> <55B8A548.4060104@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55B8A548.4060104@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2267 Lines: 38 On 29-07-15, 18:04, Pan Xinhui wrote: > > @@ -622,21 +630,20 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy, > > static ssize_t store_##file_name \ > > (struct cpufreq_policy *policy, const char *buf, size_t count) \ > > { \ > > - int ret, temp; \ > > + int ret; \ > > struct cpufreq_policy new_policy; \ > > \ > > ret = cpufreq_get_policy(&new_policy, policy->cpu); \ > > if (ret) \ > > return -EINVAL; \ > > \ > > + cpufreq_get_user_policy_freq(&policy->user_policy, &new_policy);\ > > ret = sscanf(buf, "%u", &new_policy.object); \ > > if (ret != 1) \ > > return -EINVAL; \ > > \ > > - temp = new_policy.object; \ > > - ret = cpufreq_set_policy(policy, &new_policy); \ > > - if (!ret) \ > > - policy->user_policy.object = temp; \ > > + policy->user_policy.object = policy->object; \ > should be > + policy->user_policy.object = new_policy.object; \ > sorry for that. > > + ret = cpufreq_set_policy(policy, &new_policy); \ This is wrong because we save user-preference, even when we failed. So that's surely bad. -- viresh -- 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/