diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-01-06 21:09:01 +0530 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-01-23 23:06:43 +0100 |
commit | b8c674482f3cd0d93d07dbc2518cc96c3cc24ed0 (patch) | |
tree | ae16c4a368f9a647e16d0b6f316402c6f8032fd1 /drivers/cpufreq/cpufreq_stats.c | |
parent | 00d0b29472d1605851c12c77aaa3664413a71fbf (diff) | |
download | lwn-b8c674482f3cd0d93d07dbc2518cc96c3cc24ed0.tar.gz lwn-b8c674482f3cd0d93d07dbc2518cc96c3cc24ed0.zip |
cpufreq: stats: return -EEXIST when stats are already allocated
__cpufreq_stats_create_table() is called from:
- cpufreq notifier on creation of a new policy. Stats will always be
NULL here.
- cpufreq_stats_init() for all CPUs as cpufreq-stats might have been
initialized after cpufreq driver. For any policy, 'stats' will be
NULL for the first CPU only and will be valid for all other CPUs
managed by the same policy.
While we return for other CPUs, we don't return the right error value.
It's not that we would fail with -EBUSY. But generally, this is what
these return values mean:
- EBUSY: we are busy right now, try again. And the retry attempt might
be immediate.
- EEXIST: We already have what you are trying to create and there is no
need to create it again, and so no more tries are required.
Reviewed-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_stats.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 80801f880dd8..d2299ca2fc2c 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -192,8 +192,10 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) if (unlikely(!table)) return 0; + /* stats already initialized */ if (per_cpu(cpufreq_stats_table, cpu)) - return -EBUSY; + return -EEXIST; + stat = kzalloc(sizeof(*stat), GFP_KERNEL); if ((stat) == NULL) return -ENOMEM; |