Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1733074
| From | Bo Yan <byan@nvidia.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] cpufreq: cpufreq_stats: make last_index signed int |
| Date | 2017-09-15 22:20 +0200 |
| Message-ID | <uq5fH-7Tu-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
It is possible for last_index to get a -1 if current frequency
is not found in the freq table when stats is created. If the
function "cpufreq_stats_update" is called before last_index is
updated with a valid value, the "-1" will be used as index to
update stats->time_in_state, triggering an exception.
Change the type of last_index of cpufreq_stats from unsigned int
to signed int.
Move last_time to location right before time_in_state. This helps
save 4 bytes in a LP64 programming model.
Signed-off-by: Bo Yan <byan@nvidia.com>
---
drivers/cpufreq/cpufreq_stats.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index e75880eb037d..a6838f5a2004 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -18,10 +18,10 @@ static DEFINE_SPINLOCK(cpufreq_stats_lock);
struct cpufreq_stats {
unsigned int total_trans;
- unsigned long long last_time;
unsigned int max_state;
unsigned int state_num;
- unsigned int last_index;
+ int last_index;
+ unsigned long long last_time;
u64 *time_in_state;
unsigned int *freq_table;
unsigned int *trans_table;
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] cpufreq: cpufreq_stats: make last_index signed int Bo Yan <byan@nvidia.com> - 2017-09-15 22:20 +0200
Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int Viresh Kumar <viresh.kumar@linaro.org> - 2017-09-18 04:00 +0200
Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int Bo Yan <byan@nvidia.com> - 2017-09-18 19:50 +0200
Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int Viresh Kumar <viresh.kumar@linaro.org> - 2017-09-19 21:00 +0200
csiph-web