[PATCH] drivers/firmware: kmalloc + memset -> kzalloc conversion
authorDeepak Saxena <dsaxena@plexity.net>
Mon, 7 Nov 2005 09:01:24 +0000 (01:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:54:00 +0000 (07:54 -0800)
Signed-off-by: Deepak Saxena <dsaxena@plexity.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/firmware/edd.c
drivers/firmware/efivars.c

index 6996476669f17397d1f9b1cab8e8b2f2a094cb6d..b4502ed65793a01a198b666ecba4fc7e45ac286a 100644 (file)
@@ -715,7 +715,6 @@ edd_device_register(struct edd_device *edev, int i)
 
        if (!edev)
                return 1;
-       memset(edev, 0, sizeof (*edev));
        edd_dev_set_info(edev, i);
        kobject_set_name(&edev->kobj, "int13_dev%02x",
                         0x80 + i);
@@ -756,7 +755,7 @@ edd_init(void)
                return rc;
 
        for (i = 0; i < edd_num_devices() && !rc; i++) {
-               edev = kmalloc(sizeof (*edev), GFP_KERNEL);
+               edev = kzalloc(sizeof (*edev), GFP_KERNEL);
                if (!edev)
                        return -ENOMEM;
 
index 33b17c6a46fb9a32e7c84b94b6b7970f9862fe45..bda5bce681b6bbdf0962c39e50cc3e8b4c3e1877 100644 (file)
@@ -614,16 +614,14 @@ efivar_create_sysfs_entry(unsigned long variable_name_size,
        char *short_name;
        struct efivar_entry *new_efivar;
 
-       short_name = kmalloc(short_name_size + 1, GFP_KERNEL);
-       new_efivar = kmalloc(sizeof(struct efivar_entry), GFP_KERNEL);
+       short_name = kzalloc(short_name_size + 1, GFP_KERNEL);
+       new_efivar = kzalloc(sizeof(struct efivar_entry), GFP_KERNEL);
 
        if (!short_name || !new_efivar)  {
                kfree(short_name);
                kfree(new_efivar);
                return 1;
        }
-       memset(short_name, 0, short_name_size+1);
-       memset(new_efivar, 0, sizeof(struct efivar_entry));
 
        memcpy(new_efivar->var.VariableName, variable_name,
                variable_name_size);
@@ -674,14 +672,12 @@ efivars_init(void)
        if (!efi_enabled)
                return -ENODEV;
 
-       variable_name = kmalloc(variable_name_size, GFP_KERNEL);
+       variable_name = kzalloc(variable_name_size, GFP_KERNEL);
        if (!variable_name) {
                printk(KERN_ERR "efivars: Memory allocation failed.\n");
                return -ENOMEM;
        }
 
-       memset(variable_name, 0, variable_name_size);
-
        printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
               EFIVARS_DATE);