This patch against 2.6.13-mm3 replaces malloc and memset with kzalloc in drivers/base/class.c .maybe, the better way is to write `*cls' instead of `struct class', better for further changes
Furthermore this patch fixes actually two bugs:
The memset arguments were occasionally swaped and therefore wrong.
Usage of kzalloc makes this code shorter and more bugfree.
Please apply.
Signed-off-by: Lion Vollnhals <webmaster@xxxxxxxxxx>
--- 2.6.13-mm3/drivers/base/class.c 2005-09-12 23:42:47.000000000 +0200
+++ 2.6.13-mm3-changed/drivers/base/class.c 2005-09-12 23:54:56.000000000 +0200
@@ -190,12 +190,11 @@ struct class *class_create(struct module
struct class *cls;
int retval;
- cls = kmalloc(sizeof(struct class), GFP_KERNEL);
+ cls = kzalloc(sizeof(struct class), GFP_KERNEL);
if (!cls) {[snip]
retval = -ENOMEM;
goto error;
}
- memset(cls, 0x00, sizeof(struct class));
cls->name = name;
cls->owner = owner;
@@ -611,12 +610,11 @@ struct class_device *class_device_create`*class_dev' instead of `struct class_device'
if (cls == NULL || IS_ERR(cls))
goto error;
- class_dev = kmalloc(sizeof(struct class_device), GFP_KERNEL);
+ class_dev = kzalloc(sizeof(struct class_device), GFP_KERNEL);
if (!class_dev) {thanks,
retval = -ENOMEM;
goto error;
}
- memset(class_dev, 0x00, sizeof(struct class_device));
class_dev->devt = devt;
class_dev->dev = device;