diff options
author | Robert Richter <robert.richter@amd.com> | 2010-02-25 14:20:25 -0500 |
---|---|---|
committer | Robert Richter <robert.richter@amd.com> | 2010-02-26 09:20:03 -0500 |
commit | c17c8fbf349482e89b57d1b800e83e9f4cf40c47 (patch) | |
tree | 69378aca16c1837035daab36fa146382fb61bb9d | |
parent | 68dc819ce829f7e7977a56524e710473bdb55115 (diff) |
oprofile/x86: use kzalloc() instead of kmalloc()
Cc: stable@kernel.org
Signed-off-by: Robert Richter <robert.richter@amd.com>
-rw-r--r-- | arch/x86/oprofile/nmi_int.c | 6 | ||||
-rw-r--r-- | arch/x86/oprofile/op_model_amd.c | 4 | ||||
-rw-r--r-- | arch/x86/oprofile/op_model_p4.c | 6 | ||||
-rw-r--r-- | arch/x86/oprofile/op_model_ppro.c | 6 |
4 files changed, 4 insertions, 18 deletions
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index 7170d1e29896..2c505ee71014 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -159,7 +159,7 @@ static int nmi_setup_mux(void) | |||
159 | 159 | ||
160 | for_each_possible_cpu(i) { | 160 | for_each_possible_cpu(i) { |
161 | per_cpu(cpu_msrs, i).multiplex = | 161 | per_cpu(cpu_msrs, i).multiplex = |
162 | kmalloc(multiplex_size, GFP_KERNEL); | 162 | kzalloc(multiplex_size, GFP_KERNEL); |
163 | if (!per_cpu(cpu_msrs, i).multiplex) | 163 | if (!per_cpu(cpu_msrs, i).multiplex) |
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
@@ -304,11 +304,11 @@ static int allocate_msrs(void) | |||
304 | 304 | ||
305 | int i; | 305 | int i; |
306 | for_each_possible_cpu(i) { | 306 | for_each_possible_cpu(i) { |
307 | per_cpu(cpu_msrs, i).counters = kmalloc(counters_size, | 307 | per_cpu(cpu_msrs, i).counters = kzalloc(counters_size, |
308 | GFP_KERNEL); | 308 | GFP_KERNEL); |
309 | if (!per_cpu(cpu_msrs, i).counters) | 309 | if (!per_cpu(cpu_msrs, i).counters) |
310 | return 0; | 310 | return 0; |
311 | per_cpu(cpu_msrs, i).controls = kmalloc(controls_size, | 311 | per_cpu(cpu_msrs, i).controls = kzalloc(controls_size, |
312 | GFP_KERNEL); | 312 | GFP_KERNEL); |
313 | if (!per_cpu(cpu_msrs, i).controls) | 313 | if (!per_cpu(cpu_msrs, i).controls) |
314 | return 0; | 314 | return 0; |
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c index 2aab018a7a56..f4ebc4596da8 100644 --- a/arch/x86/oprofile/op_model_amd.c +++ b/arch/x86/oprofile/op_model_amd.c | |||
@@ -147,15 +147,11 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs) | |||
147 | for (i = 0; i < NUM_COUNTERS; i++) { | 147 | for (i = 0; i < NUM_COUNTERS; i++) { |
148 | if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) | 148 | if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i)) |
149 | msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; | 149 | msrs->counters[i].addr = MSR_K7_PERFCTR0 + i; |
150 | else | ||
151 | msrs->counters[i].addr = 0; | ||
152 | } | 150 | } |
153 | 151 | ||
154 | for (i = 0; i < NUM_CONTROLS; i++) { | 152 | for (i = 0; i < NUM_CONTROLS; i++) { |
155 | if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) | 153 | if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i)) |
156 | msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; | 154 | msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i; |
157 | else | ||
158 | msrs->controls[i].addr = 0; | ||
159 | } | 155 | } |
160 | } | 156 | } |
161 | 157 | ||
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c index ac6b354becdf..e6a160a4684a 100644 --- a/arch/x86/oprofile/op_model_p4.c +++ b/arch/x86/oprofile/op_model_p4.c | |||
@@ -394,12 +394,6 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs) | |||
394 | setup_num_counters(); | 394 | setup_num_counters(); |
395 | stag = get_stagger(); | 395 | stag = get_stagger(); |
396 | 396 | ||
397 | /* initialize some registers */ | ||
398 | for (i = 0; i < num_counters; ++i) | ||
399 | msrs->counters[i].addr = 0; | ||
400 | for (i = 0; i < num_controls; ++i) | ||
401 | msrs->controls[i].addr = 0; | ||
402 | |||
403 | /* the counter & cccr registers we pay attention to */ | 397 | /* the counter & cccr registers we pay attention to */ |
404 | for (i = 0; i < num_counters; ++i) { | 398 | for (i = 0; i < num_counters; ++i) { |
405 | addr = p4_counters[VIRT_CTR(stag, i)].counter_address; | 399 | addr = p4_counters[VIRT_CTR(stag, i)].counter_address; |
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c index c344525ebb55..5d1727ba409e 100644 --- a/arch/x86/oprofile/op_model_ppro.c +++ b/arch/x86/oprofile/op_model_ppro.c | |||
@@ -37,15 +37,11 @@ static void ppro_fill_in_addresses(struct op_msrs * const msrs) | |||
37 | for (i = 0; i < num_counters; i++) { | 37 | for (i = 0; i < num_counters; i++) { |
38 | if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) | 38 | if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i)) |
39 | msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; | 39 | msrs->counters[i].addr = MSR_P6_PERFCTR0 + i; |
40 | else | ||
41 | msrs->counters[i].addr = 0; | ||
42 | } | 40 | } |
43 | 41 | ||
44 | for (i = 0; i < num_counters; i++) { | 42 | for (i = 0; i < num_counters; i++) { |
45 | if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) | 43 | if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i)) |
46 | msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; | 44 | msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i; |
47 | else | ||
48 | msrs->controls[i].addr = 0; | ||
49 | } | 45 | } |
50 | } | 46 | } |
51 | 47 | ||
@@ -57,7 +53,7 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model, | |||
57 | int i; | 53 | int i; |
58 | 54 | ||
59 | if (!reset_value) { | 55 | if (!reset_value) { |
60 | reset_value = kmalloc(sizeof(reset_value[0]) * num_counters, | 56 | reset_value = kzalloc(sizeof(reset_value[0]) * num_counters, |
61 | GFP_ATOMIC); | 57 | GFP_ATOMIC); |
62 | if (!reset_value) | 58 | if (!reset_value) |
63 | return; | 59 | return; |