Skip to contentSkip to conversation

mtrr: replace kmalloc+memset with kzalloc

PATCH New Burman Yan 1 participant 1 message Nov 15, 2006

lore
Share & tools
lore

Burman Yan

author
#0 lore raw

PATCH 1/1 mtrr: replace kmalloc+memset with kzalloc

Hi.

This patch replaces kmalloc+memset with kzalloc in mtrr related files

Regards
Yan Burman

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Replace kmalloc+memset with kzalloc

arch/i386/kernel/cpu/mtrr/if.c +1 -2
diff -rubp linux-2.6.19-rc5_orig/arch/i386/kernel/cpu/mtrr/if.c linux-2.6.19-rc5_kzalloc/arch/i386/kernel/cpu/mtrr/if.c
@@ -44,10 +44,9 @@ mtrr_file_add(unsigned long base, unsign
 
 	max = num_var_ranges;
 	if (fcount == NULL) {
-		fcount = kmalloc(max * sizeof *fcount, GFP_KERNEL);
+		fcount = kzalloc(max * sizeof *fcount, GFP_KERNEL);
 		if (!fcount)
 			return -ENOMEM;
-		memset(fcount, 0, max * sizeof *fcount);
 		FILE_FCOUNT(file) = fcount;
 	}
 	if (!page) {
arch/i386/kernel/cpu/mtrr/main.c +2 -4
diff -rubp linux-2.6.19-rc5_orig/arch/i386/kernel/cpu/mtrr/main.c linux-2.6.19-rc5_kzalloc/arch/i386/kernel/cpu/mtrr/main.c
@@ -565,10 +565,8 @@ static int mtrr_save(struct sys_device *
 	int i;
 	int size = num_var_ranges * sizeof(struct mtrr_value);
 
-	mtrr_state = kmalloc(size,GFP_ATOMIC);
-	if (mtrr_state)
-		memset(mtrr_state,0,size);
-	else
+	mtrr_state = kzalloc(size,GFP_ATOMIC);
+	if (!mtrr_state)
 		return -ENOMEM;
 
 	for (i = 0; i < num_var_ranges; i++) {