diff options
author | Oliver Neukum <neukum@fachschaft.cup.uni-muenchen.de> | 2006-03-25 03:08:13 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-25 08:23:00 -0800 |
commit | 11b0b5abb2097a63c1081d9b7e825b987b227972 (patch) | |
tree | 162c828c8d807a1b30869acbe11682dc9222dc16 /fs/char_dev.c | |
parent | 656bde5728b824ca23fcab8bc5800b309ea48d64 (diff) | |
download | lwn-11b0b5abb2097a63c1081d9b7e825b987b227972.tar.gz lwn-11b0b5abb2097a63c1081d9b7e825b987b227972.zip |
[PATCH] use kzalloc and kcalloc in core fs code
Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/char_dev.c')
-rw-r--r-- | fs/char_dev.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/char_dev.c b/fs/char_dev.c index 5c36345c9bf7..8c6eb04d31e2 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -146,12 +146,10 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, int ret = 0; int i; - cd = kmalloc(sizeof(struct char_device_struct), GFP_KERNEL); + cd = kzalloc(sizeof(struct char_device_struct), GFP_KERNEL); if (cd == NULL) return ERR_PTR(-ENOMEM); - memset(cd, 0, sizeof(struct char_device_struct)); - mutex_lock(&chrdevs_lock); /* temporary */ @@ -466,9 +464,8 @@ static struct kobj_type ktype_cdev_dynamic = { struct cdev *cdev_alloc(void) { - struct cdev *p = kmalloc(sizeof(struct cdev), GFP_KERNEL); + struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); if (p) { - memset(p, 0, sizeof(struct cdev)); p->kobj.ktype = &ktype_cdev_dynamic; INIT_LIST_HEAD(&p->list); kobject_init(&p->kobj); |