[PATCH] x86-64: replace kmalloc+memset with kzalloc in MTRR code
Cc: Andi Kleen <ak@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Andi Kleen <ak@suse.de>
This commit is contained in:
parent
d5d2448d89
commit
9cfa5b5dfa
2 changed files with 3 additions and 6 deletions
|
@ -44,10 +44,9 @@ mtrr_file_add(unsigned long base, unsigned long size,
|
||||||
|
|
||||||
max = num_var_ranges;
|
max = num_var_ranges;
|
||||||
if (fcount == NULL) {
|
if (fcount == NULL) {
|
||||||
fcount = kmalloc(max * sizeof *fcount, GFP_KERNEL);
|
fcount = kzalloc(max * sizeof *fcount, GFP_KERNEL);
|
||||||
if (!fcount)
|
if (!fcount)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memset(fcount, 0, max * sizeof *fcount);
|
|
||||||
FILE_FCOUNT(file) = fcount;
|
FILE_FCOUNT(file) = fcount;
|
||||||
}
|
}
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
|
|
@ -596,10 +596,8 @@ static int mtrr_save(struct sys_device * sysdev, pm_message_t state)
|
||||||
int i;
|
int i;
|
||||||
int size = num_var_ranges * sizeof(struct mtrr_value);
|
int size = num_var_ranges * sizeof(struct mtrr_value);
|
||||||
|
|
||||||
mtrr_state = kmalloc(size,GFP_ATOMIC);
|
mtrr_state = kzalloc(size,GFP_ATOMIC);
|
||||||
if (mtrr_state)
|
if (!mtrr_state)
|
||||||
memset(mtrr_state,0,size);
|
|
||||||
else
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
for (i = 0; i < num_var_ranges; i++) {
|
for (i = 0; i < num_var_ranges; i++) {
|
||||||
|
|
Loading…
Reference in a new issue