aboutsummaryrefslogtreecommitdiffstats
path: root/fs/char_dev.c
diff options
context:
space:
mode:
authorOliver Neukum <neukum@fachschaft.cup.uni-muenchen.de>2006-03-25 06:08:13 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:23:00 -0500
commit11b0b5abb2097a63c1081d9b7e825b987b227972 (patch)
tree162c828c8d807a1b30869acbe11682dc9222dc16 /fs/char_dev.c
parent656bde5728b824ca23fcab8bc5800b309ea48d64 (diff)
[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.c7
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,
146 int ret = 0; 146 int ret = 0;
147 int i; 147 int i;
148 148
149 cd = kmalloc(sizeof(struct char_device_struct), GFP_KERNEL); 149 cd = kzalloc(sizeof(struct char_device_struct), GFP_KERNEL);
150 if (cd == NULL) 150 if (cd == NULL)
151 return ERR_PTR(-ENOMEM); 151 return ERR_PTR(-ENOMEM);
152 152
153 memset(cd, 0, sizeof(struct char_device_struct));
154
155 mutex_lock(&chrdevs_lock); 153 mutex_lock(&chrdevs_lock);
156 154
157 /* temporary */ 155 /* temporary */
@@ -466,9 +464,8 @@ static struct kobj_type ktype_cdev_dynamic = {
466 464
467struct cdev *cdev_alloc(void) 465struct cdev *cdev_alloc(void)
468{ 466{
469 struct cdev *p = kmalloc(sizeof(struct cdev), GFP_KERNEL); 467 struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL);
470 if (p) { 468 if (p) {
471 memset(p, 0, sizeof(struct cdev));
472 p->kobj.ktype = &ktype_cdev_dynamic; 469 p->kobj.ktype = &ktype_cdev_dynamic;
473 INIT_LIST_HEAD(&p->list); 470 INIT_LIST_HEAD(&p->list);
474 kobject_init(&p->kobj); 471 kobject_init(&p->kobj);