aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/oprofile/nmi_int.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 3b84b789de0..80b63d5db50 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -71,18 +71,16 @@ static int profile_exceptions_notify(struct notifier_block *self,
71 71
72static void nmi_cpu_save_registers(struct op_msrs *msrs) 72static void nmi_cpu_save_registers(struct op_msrs *msrs)
73{ 73{
74 unsigned int const nr_ctrs = model->num_counters;
75 unsigned int const nr_ctrls = model->num_controls;
76 struct op_msr *counters = msrs->counters; 74 struct op_msr *counters = msrs->counters;
77 struct op_msr *controls = msrs->controls; 75 struct op_msr *controls = msrs->controls;
78 unsigned int i; 76 unsigned int i;
79 77
80 for (i = 0; i < nr_ctrs; ++i) { 78 for (i = 0; i < model->num_counters; ++i) {
81 if (counters[i].addr) 79 if (counters[i].addr)
82 rdmsrl(counters[i].addr, counters[i].saved); 80 rdmsrl(counters[i].addr, counters[i].saved);
83 } 81 }
84 82
85 for (i = 0; i < nr_ctrls; ++i) { 83 for (i = 0; i < model->num_controls; ++i) {
86 if (controls[i].addr) 84 if (controls[i].addr)
87 rdmsrl(controls[i].addr, controls[i].saved); 85 rdmsrl(controls[i].addr, controls[i].saved);
88 } 86 }
@@ -191,18 +189,16 @@ static int nmi_setup(void)
191 189
192static void nmi_restore_registers(struct op_msrs *msrs) 190static void nmi_restore_registers(struct op_msrs *msrs)
193{ 191{
194 unsigned int const nr_ctrs = model->num_counters;
195 unsigned int const nr_ctrls = model->num_controls;
196 struct op_msr *counters = msrs->counters; 192 struct op_msr *counters = msrs->counters;
197 struct op_msr *controls = msrs->controls; 193 struct op_msr *controls = msrs->controls;
198 unsigned int i; 194 unsigned int i;
199 195
200 for (i = 0; i < nr_ctrls; ++i) { 196 for (i = 0; i < model->num_controls; ++i) {
201 if (controls[i].addr) 197 if (controls[i].addr)
202 wrmsrl(controls[i].addr, controls[i].saved); 198 wrmsrl(controls[i].addr, controls[i].saved);
203 } 199 }
204 200
205 for (i = 0; i < nr_ctrs; ++i) { 201 for (i = 0; i < model->num_counters; ++i) {
206 if (counters[i].addr) 202 if (counters[i].addr)
207 wrmsrl(counters[i].addr, counters[i].saved); 203 wrmsrl(counters[i].addr, counters[i].saved);
208 } 204 }