diff options
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, | |||
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 | ||
467 | struct cdev *cdev_alloc(void) | 465 | struct 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); |