Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8742
b: refs/heads/master
c: 4aed064
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Sep 13, 2005
1 parent 15c3b1b commit 03238e3
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 299cc3c166f7a11f6cc3b66aafbaf75c2aa0e0e2
refs/heads/master: 4aed0644d684428e811bb6944f032b460a3ab165
5 changes: 3 additions & 2 deletions trunk/drivers/base/attribute_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ attribute_container_add_device(struct device *dev,

if (!cont->match(cont, dev))
continue;
ic = kmalloc(sizeof(struct internal_container), GFP_KERNEL);

ic = kzalloc(sizeof(*ic), GFP_KERNEL);
if (!ic) {
dev_printk(KERN_ERR, dev, "failed to allocate class container\n");
continue;
}
memset(ic, 0, sizeof(struct internal_container));

ic->cont = cont;
class_device_initialize(&ic->classdev);
ic->classdev.dev = get_device(dev);
Expand Down
10 changes: 4 additions & 6 deletions trunk/drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ struct class *class_create(struct module *owner, char *name)
struct class *cls;
int retval;

cls = kmalloc(sizeof(struct class), GFP_KERNEL);
cls = kzalloc(sizeof(*cls), GFP_KERNEL);
if (!cls) {
retval = -ENOMEM;
goto error;
}
memset(cls, 0x00, sizeof(struct class));

cls->name = name;
cls->owner = owner;
Expand Down Expand Up @@ -500,13 +499,13 @@ int class_device_add(struct class_device *class_dev)
/* add the needed attributes to this device */
if (MAJOR(class_dev->devt)) {
struct class_device_attribute *attr;
attr = kmalloc(sizeof(*attr), GFP_KERNEL);
attr = kzalloc(sizeof(*attr), GFP_KERNEL);
if (!attr) {
error = -ENOMEM;
kobject_del(&class_dev->kobj);
goto register_done;
}
memset(attr, sizeof(*attr), 0x00);

attr->attr.name = "dev";
attr->attr.mode = S_IRUGO;
attr->attr.owner = parent->owner;
Expand Down Expand Up @@ -577,12 +576,11 @@ struct class_device *class_device_create(struct class *cls, dev_t devt,
if (cls == NULL || IS_ERR(cls))
goto error;

class_dev = kmalloc(sizeof(struct class_device), GFP_KERNEL);
class_dev = kzalloc(sizeof(*class_dev), GFP_KERNEL);
if (!class_dev) {
retval = -ENOMEM;
goto error;
}
memset(class_dev, 0x00, sizeof(struct class_device));

class_dev->devt = devt;
class_dev->dev = device;
Expand Down
9 changes: 3 additions & 6 deletions trunk/drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ fw_register_class_device(struct class_device **class_dev_p,
const char *fw_name, struct device *device)
{
int retval;
struct firmware_priv *fw_priv = kmalloc(sizeof (struct firmware_priv),
struct firmware_priv *fw_priv = kzalloc(sizeof(*fw_priv),
GFP_KERNEL);
struct class_device *class_dev = kmalloc(sizeof (struct class_device),
struct class_device *class_dev = kzalloc(sizeof(*class_dev),
GFP_KERNEL);

*class_dev_p = NULL;
Expand All @@ -313,8 +313,6 @@ fw_register_class_device(struct class_device **class_dev_p,
retval = -ENOMEM;
goto error_kfree;
}
memset(fw_priv, 0, sizeof (*fw_priv));
memset(class_dev, 0, sizeof (*class_dev));

init_completion(&fw_priv->completion);
fw_priv->attr_data = firmware_attr_data_tmpl;
Expand Down Expand Up @@ -402,14 +400,13 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
if (!firmware_p)
return -EINVAL;

*firmware_p = firmware = kmalloc(sizeof (struct firmware), GFP_KERNEL);
*firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
if (!firmware) {
printk(KERN_ERR "%s: kmalloc(struct firmware) failed\n",
__FUNCTION__);
retval = -ENOMEM;
goto out;
}
memset(firmware, 0, sizeof (*firmware));

retval = fw_setup_class_device(firmware, &class_dev, name, device,
hotplug);
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/base/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ struct kobject *kobj_lookup(struct kobj_map *domain, dev_t dev, int *index)
struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct semaphore *sem)
{
struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL);
struct probe *base = kmalloc(sizeof(struct probe), GFP_KERNEL);
struct probe *base = kzalloc(sizeof(*base), GFP_KERNEL);
int i;

if ((p == NULL) || (base == NULL)) {
Expand All @@ -144,7 +144,6 @@ struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct semaphore *sem)
return NULL;
}

memset(base, 0, sizeof(struct probe));
base->dev = 1;
base->range = ~0;
base->get = base_probe;
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,12 @@ struct platform_device *platform_device_register_simple(char *name, unsigned int
struct platform_object *pobj;
int retval;

pobj = kmalloc(sizeof(struct platform_object) + sizeof(struct resource) * num, GFP_KERNEL);
pobj = kzalloc(sizeof(*pobj) + sizeof(struct resource) * num, GFP_KERNEL);
if (!pobj) {
retval = -ENOMEM;
goto error;
}

memset(pobj, 0, sizeof(*pobj));
pobj->pdev.name = name;
pobj->pdev.id = id;
pobj->pdev.dev.release = platform_device_release_simple;
Expand Down

0 comments on commit 03238e3

Please sign in to comment.