[PATCH] Perf, AMD: Prefer kzalloc() over kmalloc()+memset() inamd_alloc_nb()

From: Jesper Juhl
Date: Sat Oct 30 2010 - 15:16:40 EST



Hi,

I believe this would be an improvement?

Prefer kzalloc() over kmalloc()+memset() in amd_alloc_nb().


Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
---
perf_event_amd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 46d5844..a3787b2 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -280,11 +280,10 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
struct amd_nb *nb;
int i;

- nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL);
+ nb = kzalloc(sizeof(struct amd_nb), GFP_KERNEL);
if (!nb)
return NULL;

- memset(nb, 0, sizeof(*nb));
nb->nb_id = nb_id;

/*


--
Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
Plain text mails only, please http://www.expita.com/nomime.html
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/