oprofile/x86: use kzalloc() instead of kmalloc()
authorRobert Richter <robert.richter@amd.com>
Thu, 25 Feb 2010 19:20:25 +0000 (20:20 +0100)
committerRobert Richter <robert.richter@amd.com>
Fri, 26 Feb 2010 14:20:03 +0000 (15:20 +0100)
Cc: stable@kernel.org
Signed-off-by: Robert Richter <robert.richter@amd.com>
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/op_model_amd.c
arch/x86/oprofile/op_model_p4.c
arch/x86/oprofile/op_model_ppro.c

index 7170d1e2989628072c3b187afb334f477def3cd3..2c505ee7101488b7032aad6f89d15ddb134457aa 100644 (file)
@@ -159,7 +159,7 @@ static int nmi_setup_mux(void)
 
        for_each_possible_cpu(i) {
                per_cpu(cpu_msrs, i).multiplex =
-                       kmalloc(multiplex_size, GFP_KERNEL);
+                       kzalloc(multiplex_size, GFP_KERNEL);
                if (!per_cpu(cpu_msrs, i).multiplex)
                        return 0;
        }
@@ -304,11 +304,11 @@ static int allocate_msrs(void)
 
        int i;
        for_each_possible_cpu(i) {
-               per_cpu(cpu_msrs, i).counters = kmalloc(counters_size,
+               per_cpu(cpu_msrs, i).counters = kzalloc(counters_size,
                                                        GFP_KERNEL);
                if (!per_cpu(cpu_msrs, i).counters)
                        return 0;
-               per_cpu(cpu_msrs, i).controls = kmalloc(controls_size,
+               per_cpu(cpu_msrs, i).controls = kzalloc(controls_size,
                                                        GFP_KERNEL);
                if (!per_cpu(cpu_msrs, i).controls)
                        return 0;
index 2aab018a7a56e793c21263ac54f5ec6e1c73a6c2..f4ebc4596da8fea3d02608333b140e11e35714d1 100644 (file)
@@ -147,15 +147,11 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs)
        for (i = 0; i < NUM_COUNTERS; i++) {
                if (reserve_perfctr_nmi(MSR_K7_PERFCTR0 + i))
                        msrs->counters[i].addr = MSR_K7_PERFCTR0 + i;
-               else
-                       msrs->counters[i].addr = 0;
        }
 
        for (i = 0; i < NUM_CONTROLS; i++) {
                if (reserve_evntsel_nmi(MSR_K7_EVNTSEL0 + i))
                        msrs->controls[i].addr = MSR_K7_EVNTSEL0 + i;
-               else
-                       msrs->controls[i].addr = 0;
        }
 }
 
index ac6b354becdfe9f5859aa7930cc6b2aedb9f17e2..e6a160a4684a4a9d96914acc161122d6c7f8c208 100644 (file)
@@ -394,12 +394,6 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs)
        setup_num_counters();
        stag = get_stagger();
 
-       /* initialize some registers */
-       for (i = 0; i < num_counters; ++i)
-               msrs->counters[i].addr = 0;
-       for (i = 0; i < num_controls; ++i)
-               msrs->controls[i].addr = 0;
-
        /* the counter & cccr registers we pay attention to */
        for (i = 0; i < num_counters; ++i) {
                addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
index c344525ebb55facfb96c5a01f184535306f103da..5d1727ba409edf7b1bbe2f28d0b38711cd3625fd 100644 (file)
@@ -37,15 +37,11 @@ static void ppro_fill_in_addresses(struct op_msrs * const msrs)
        for (i = 0; i < num_counters; i++) {
                if (reserve_perfctr_nmi(MSR_P6_PERFCTR0 + i))
                        msrs->counters[i].addr = MSR_P6_PERFCTR0 + i;
-               else
-                       msrs->counters[i].addr = 0;
        }
 
        for (i = 0; i < num_counters; i++) {
                if (reserve_evntsel_nmi(MSR_P6_EVNTSEL0 + i))
                        msrs->controls[i].addr = MSR_P6_EVNTSEL0 + i;
-               else
-                       msrs->controls[i].addr = 0;
        }
 }
 
@@ -57,7 +53,7 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,
        int i;
 
        if (!reset_value) {
-               reset_value = kmalloc(sizeof(reset_value[0]) * num_counters,
+               reset_value = kzalloc(sizeof(reset_value[0]) * num_counters,
                                        GFP_ATOMIC);
                if (!reset_value)
                        return;