From patchwork Mon Aug 3 03:06:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51836 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 499B2229FD for ; Mon, 3 Aug 2015 03:07:08 +0000 (UTC) Received: by lbbnr7 with SMTP id nr7sf37344209lbb.2 for ; Sun, 02 Aug 2015 20:07:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=cIr6iBwoHkxLN7TMCA3rzmLfuFC9N2Z3rWE2mCV5LS4=; b=SpcA0l/u7kHUwRBQ7KsRLIHR8vpwEHqIljAjRzQX4XoI8zE/D2d6GN051c0GkYQGiT V3cvSz/G9zwjULjtBfFM0iP+l6k/o7lix/YTxzCNEWZWQ0iQjXAcw2q69XBKLVcJQ0tm uGKFq8V4WixyNbBLjJtpT92fENgelLaQoZxbpo5oIviI2x97IQOZY12B/JSI3UtLKmzG uB6cY1tJ0cLTiuqEqSReJMhjIZVu7IXkvK0xnfkuqPEoik5LstoqtEjq6ms07lgNHFsv jpJbgk2YPy+pESmAgeLXvjC+LC3rtVfU8YE+xptvu/mjfXLqf4WPH9MiPtfDVlPvWVgO IKWQ== X-Gm-Message-State: ALoCoQm6hgWNPg92mvTVITBS+Ga7FONE7EN/ldDMYx/7oTvo1ly/JWIDm5cwBcZxB/blxGmEYhgs X-Received: by 10.180.35.162 with SMTP id i2mr5105771wij.6.1438571227238; Sun, 02 Aug 2015 20:07:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.133 with SMTP id v5ls259890lae.63.gmail; Sun, 02 Aug 2015 20:07:07 -0700 (PDT) X-Received: by 10.152.23.136 with SMTP id m8mr12230247laf.124.1438571227036; Sun, 02 Aug 2015 20:07:07 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id tp6si10811339lbb.97.2015.08.02.20.07.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Aug 2015 20:07:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbqc9 with SMTP id c9so45407728lbq.1 for ; Sun, 02 Aug 2015 20:07:06 -0700 (PDT) X-Received: by 10.152.18.162 with SMTP id x2mr14729519lad.73.1438571226904; Sun, 02 Aug 2015 20:07:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1626620lba; Sun, 2 Aug 2015 20:07:05 -0700 (PDT) X-Received: by 10.68.113.194 with SMTP id ja2mr19072030pbb.46.1438571224085; Sun, 02 Aug 2015 20:07:04 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tb2si23989280pab.75.2015.08.02.20.07.02; Sun, 02 Aug 2015 20:07:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752746AbbHCDGu (ORCPT + 28 others); Sun, 2 Aug 2015 23:06:50 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:33203 "EHLO mail-pa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752726AbbHCDGr (ORCPT ); Sun, 2 Aug 2015 23:06:47 -0400 Received: by padck2 with SMTP id ck2so78253099pad.0 for ; Sun, 02 Aug 2015 20:06:47 -0700 (PDT) X-Received: by 10.68.104.67 with SMTP id gc3mr7297696pbb.103.1438571207099; Sun, 02 Aug 2015 20:06:47 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id bd5sm6006248pbb.85.2015.08.02.20.06.46 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 02 Aug 2015 20:06:46 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/7] cpufreq: update user_policy.* on success Date: Mon, 3 Aug 2015 08:36:16 +0530 Message-Id: <141bb39218b253c4952eb9d98eb72a8a8dc98e49.1438571116.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 'user_policy' caches properties of a policy that are set by userspace. And these must be updated only if cpufreq core was successful in updating them based on request from user space. In store_scaling_governor(), we are updating user_policy.policy and user_policy.governor even if cpufreq_set_policy() failed. That's incorrect. Fix this by updating user_policy.* only if we were successful in updating the properties. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 86d69416821b..8e71d8e08439 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -671,14 +671,12 @@ static ssize_t store_scaling_governor(struct cpufreq_policy *policy, return -EINVAL; ret = cpufreq_set_policy(policy, &new_policy); + if (ret) + return ret; policy->user_policy.policy = policy->policy; policy->user_policy.governor = policy->governor; - - if (ret) - return ret; - else - return count; + return count; } /**