aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/sem.c
diff options
context:
space:
mode:
authorMatt Helsley <matthltc@us.ibm.com>2006-10-02 05:18:25 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:22 -0400
commit2453a3062d36f39f01302f9f1ad18e7a0c54fe38 (patch)
treef684fbca3edfdcaeca3618a0c518bcf39418c9fc /ipc/sem.c
parent5d124e99c2fee1c8f3020ecb0dff8d5617ee7991 (diff)
[PATCH] ipc: replace kmalloc and memset in get_undo_list with kzalloc
Simplify get_undo_list() by dropping the unnecessary cast, removing the size variable, and switching to kzalloc() instead of a kmalloc() followed by a memset(). This cleanup was split then modified from Jes Sorenson's Task Notifiers patches. Signed-off-by: Matt Helsley <matthltc@us.ibm.com> Cc: Jes Sorensen <jes@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'ipc/sem.c')
-rw-r--r--ipc/sem.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 69edeb1e2a65..0dafcc455f92 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1003,15 +1003,12 @@ static inline void unlock_semundo(void)
1003static inline int get_undo_list(struct sem_undo_list **undo_listp) 1003static inline int get_undo_list(struct sem_undo_list **undo_listp)
1004{ 1004{
1005 struct sem_undo_list *undo_list; 1005 struct sem_undo_list *undo_list;
1006 int size;
1007 1006
1008 undo_list = current->sysvsem.undo_list; 1007 undo_list = current->sysvsem.undo_list;
1009 if (!undo_list) { 1008 if (!undo_list) {
1010 size = sizeof(struct sem_undo_list); 1009 undo_list = kzalloc(sizeof(*undo_list), GFP_KERNEL);
1011 undo_list = (struct sem_undo_list *) kmalloc(size, GFP_KERNEL);
1012 if (undo_list == NULL) 1010 if (undo_list == NULL)
1013 return -ENOMEM; 1011 return -ENOMEM;
1014 memset(undo_list, 0, size);
1015 spin_lock_init(&undo_list->lock); 1012 spin_lock_init(&undo_list->lock);
1016 atomic_set(&undo_list->refcnt, 1); 1013 atomic_set(&undo_list->refcnt, 1);
1017 current->sysvsem.undo_list = undo_list; 1014 current->sysvsem.undo_list = undo_list;