summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/microcode_amd.c
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2010-11-01 22:44:34 +0100
committerBorislav Petkov <borislav.petkov@amd.com>2010-11-10 14:48:57 +0100
commit1ea6be212eea5ce1e8fabadacb0c639ad87b2f00 (patch)
tree4b2b18a122a4acfc38ffcd25c7ec9835e6c5c418 /arch/x86/kernel/microcode_amd.c
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6 (diff)
downloadlinux-1ea6be212eea5ce1e8fabadacb0c639ad87b2f00.tar.xz
linux-1ea6be212eea5ce1e8fabadacb0c639ad87b2f00.zip
x86, microcode, AMD: Replace vmalloc+memset with vzalloc
We don't have to do memset() ourselves after vmalloc() when we have vzalloc(), so change that in arch/x86/kernel/microcode_amd.c::get_next_ucode(). Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86/kernel/microcode_amd.c')
-rw-r--r--arch/x86/kernel/microcode_amd.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index e1af7c055c7d..383d4f8ec9e1 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -183,16 +183,17 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
return NULL;
}
- mc = vmalloc(UCODE_MAX_SIZE);
- if (mc) {
- memset(mc, 0, UCODE_MAX_SIZE);
- if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR,
- total_size)) {
- vfree(mc);
- mc = NULL;
- } else
- *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
+ mc = vzalloc(UCODE_MAX_SIZE);
+ if (!mc)
+ return NULL;
+
+ if (get_ucode_data(mc, buf + UCODE_CONTAINER_SECTION_HDR, total_size)) {
+ vfree(mc);
+ mc = NULL;
+ } else {
+ *mc_size = total_size + UCODE_CONTAINER_SECTION_HDR;
}
+
return mc;
}