aboutsummaryrefslogtreecommitdiffstats
path: root/init/initramfs.c
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2008-04-29 03:59:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:06 -0400
commit3265e66b1825942c6e0fc457986cdf941a5f7d37 (patch)
tree9ea1d7eee09d60bad4a5ebc4140088a0203de7af /init/initramfs.c
parent5f97a5a8799b8d7d0afdb9d68a50a4e0e8298a05 (diff)
directly use kmalloc() and kfree() in init/initramfs.c
Instead of using the malloc() and free() wrappers needed by the lib/inflate.c code for allocations, simply use kmalloc() and kfree() in the initramfs code. This is needed for a further lib/inflate.c-related cleanup patch that will remove the malloc() and free() functions. Take that opportunity to remove the useless kmalloc() return value cast. Based on work done by Matt Mackall. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Matt Mackall <mpm@selenic.com> Cc: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index d53fee8d8604..8eeeccb328c9 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -57,7 +57,7 @@ static char __init *find_link(int major, int minor, int ino,
57 continue; 57 continue;
58 return (*p)->name; 58 return (*p)->name;
59 } 59 }
60 q = (struct hash *)malloc(sizeof(struct hash)); 60 q = kmalloc(sizeof(struct hash), GFP_KERNEL);
61 if (!q) 61 if (!q)
62 panic("can't allocate link hash entry"); 62 panic("can't allocate link hash entry");
63 q->major = major; 63 q->major = major;
@@ -77,7 +77,7 @@ static void __init free_hash(void)
77 while (*p) { 77 while (*p) {
78 q = *p; 78 q = *p;
79 *p = q->next; 79 *p = q->next;
80 free(q); 80 kfree(q);
81 } 81 }
82 } 82 }
83} 83}
@@ -445,10 +445,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
445{ 445{
446 int written; 446 int written;
447 dry_run = check_only; 447 dry_run = check_only;
448 header_buf = malloc(110); 448 header_buf = kmalloc(110, GFP_KERNEL);
449 symlink_buf = malloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1); 449 symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL);
450 name_buf = malloc(N_ALIGN(PATH_MAX)); 450 name_buf = kmalloc(N_ALIGN(PATH_MAX), GFP_KERNEL);
451 window = malloc(WSIZE); 451 window = kmalloc(WSIZE, GFP_KERNEL);
452 if (!window || !header_buf || !symlink_buf || !name_buf) 452 if (!window || !header_buf || !symlink_buf || !name_buf)
453 panic("can't allocate buffers"); 453 panic("can't allocate buffers");
454 state = Start; 454 state = Start;
@@ -484,10 +484,10 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only)
484 buf += inptr; 484 buf += inptr;
485 len -= inptr; 485 len -= inptr;
486 } 486 }
487 free(window); 487 kfree(window);
488 free(name_buf); 488 kfree(name_buf);
489 free(symlink_buf); 489 kfree(symlink_buf);
490 free(header_buf); 490 kfree(header_buf);
491 return message; 491 return message;
492} 492}
493 493