From: Matt Helsley <matthltc@us.ibm.com>
To: trivial@kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>, Jes Sorensen <jes@sgi.com>
Subject: Replace kmalloc and memset in get_undo_list with kzalloc
Date: Mon, 12 Jun 2006 19:31:05 -0700 [thread overview]
Message-ID: <1150165865.21787.85.camel@stark> (raw)
This patch simplifies 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>
--
Compiles, boots.
ipc/sem.c | 5 +----
1 files changed, 1 insertion(+), 4 deletions(-)
Index: linux-2.6.17-rc6/ipc/sem.c
===================================================================
--- linux-2.6.17-rc6.orig/ipc/sem.c
+++ linux-2.6.17-rc6/ipc/sem.c
@@ -1002,19 +1002,16 @@ static inline void unlock_semundo(void)
* This can block, so callers must hold no locks.
*/
static inline int get_undo_list(struct sem_undo_list **undo_listp)
{
struct sem_undo_list *undo_list;
- int size;
undo_list = current->sysvsem.undo_list;
if (!undo_list) {
- size = sizeof(struct sem_undo_list);
- undo_list = (struct sem_undo_list *) kmalloc(size, GFP_KERNEL);
+ undo_list = kzalloc(sizeof(*undo_list), GFP_KERNEL);
if (undo_list == NULL)
return -ENOMEM;
- memset(undo_list, 0, size);
spin_lock_init(&undo_list->lock);
atomic_set(&undo_list->refcnt, 1);
current->sysvsem.undo_list = undo_list;
}
*undo_listp = undo_list;
reply other threads:[~2006-06-13 2:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1150165865.21787.85.camel@stark \
--to=matthltc@us.ibm.com \
--cc=jes@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=trivial@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.