Commit 6d4f9c55 authored by Pekka Enberg's avatar Pekka Enberg Committed by Linus Torvalds

module: use krealloc

This converts an open-coded krealloc() to use the shiny new API.
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Acked-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent fe08a9d4
...@@ -310,14 +310,14 @@ static int split_block(unsigned int i, unsigned short size) ...@@ -310,14 +310,14 @@ static int split_block(unsigned int i, unsigned short size)
{ {
/* Reallocation required? */ /* Reallocation required? */
if (pcpu_num_used + 1 > pcpu_num_allocated) { if (pcpu_num_used + 1 > pcpu_num_allocated) {
int *new = kmalloc(sizeof(new[0]) * pcpu_num_allocated*2, int *new;
new = krealloc(pcpu_size, sizeof(new[0])*pcpu_num_allocated*2,
GFP_KERNEL); GFP_KERNEL);
if (!new) if (!new)
return 0; return 0;
memcpy(new, pcpu_size, sizeof(new[0])*pcpu_num_allocated);
pcpu_num_allocated *= 2; pcpu_num_allocated *= 2;
kfree(pcpu_size);
pcpu_size = new; pcpu_size = new;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment