ACPI: replace kmalloc+memset with kzalloc
authorBurman Yan <yan_952@hotmail.com>
Tue, 19 Dec 2006 20:56:11 +0000 (12:56 -0800)
committerLen Brown <len.brown@intel.com>
Wed, 20 Dec 2006 21:54:54 +0000 (16:54 -0500)
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Len Brown <len.brown@intel.com>
22 files changed:
arch/ia64/kernel/cpufreq/acpi-cpufreq.c
drivers/acpi/ac.c
drivers/acpi/acpi_memhotplug.c
drivers/acpi/asus_acpi.c
drivers/acpi/battery.c
drivers/acpi/container.c
drivers/acpi/ec.c
drivers/acpi/fan.c
drivers/acpi/i2c_ec.c
drivers/acpi/ibm_acpi.c
drivers/acpi/pci_bind.c
drivers/acpi/pci_irq.c
drivers/acpi/pci_link.c
drivers/acpi/pci_root.c
drivers/acpi/power.c
drivers/acpi/processor_core.c
drivers/acpi/sbs.c
drivers/acpi/scan.c
drivers/acpi/thermal.c
drivers/acpi/utils.c
drivers/acpi/video.c
drivers/pci/hotplug/acpiphp_ibm.c

index 088f130197ae5240f63db2dc02bbc4b7fa213025..15c08d52f09fb60038ff85db84a2ede007c0867f 100644 (file)
@@ -276,12 +276,10 @@ acpi_cpufreq_cpu_init (
 
        dprintk("acpi_cpufreq_cpu_init\n");
 
-       data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
+       data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
        if (!data)
                return (-ENOMEM);
 
-       memset(data, 0, sizeof(struct cpufreq_acpi_io));
-
        acpi_io_data[cpu] = data;
 
        result = acpi_processor_register_performance(&data->acpi_data, cpu);
index 46e58663dcb5dd75936894c5d4389a7dcb985ffc..6daeace796a86c2b3e7892c517b5bab107ceb8a7 100644 (file)
@@ -221,10 +221,9 @@ static int acpi_ac_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
+       ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
        if (!ac)
                return -ENOMEM;
-       memset(ac, 0, sizeof(struct acpi_ac));
 
        ac->device = device;
        strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
index 150112ae48ed7e6bfdd4afefa7d17b7bd244845d..cd946ed192d3e38a1539fcd58abfcfaf06258c26 100644 (file)
@@ -395,10 +395,9 @@ static int acpi_memory_device_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
+       mem_device = kzalloc(sizeof(struct acpi_memory_device), GFP_KERNEL);
        if (!mem_device)
                return -ENOMEM;
-       memset(mem_device, 0, sizeof(struct acpi_memory_device));
 
        INIT_LIST_HEAD(&mem_device->res_list);
        mem_device->device = device;
index 7cc54aacd4c082f8623eb5a90a382f99ddda499b..396140bbbe576bc83f945896c32ad7d8dcc6ef38 100644 (file)
@@ -1264,10 +1264,9 @@ static int asus_hotk_add(struct acpi_device *device)
        printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n",
               ASUS_ACPI_VERSION);
 
-       hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL);
+       hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL);
        if (!hotk)
                return -ENOMEM;
-       memset(hotk, 0, sizeof(struct asus_hotk));
 
        hotk->handle = device->handle;
        strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME);
index f47c78a106561e23f3d179a3055fec3372c27734..5f43e0d1489994673a75950838815acfe70c6704 100644 (file)
@@ -160,12 +160,11 @@ acpi_battery_get_info(struct acpi_battery *battery,
                goto end;
        }
 
-       data.pointer = kmalloc(data.length, GFP_KERNEL);
+       data.pointer = kzalloc(data.length, GFP_KERNEL);
        if (!data.pointer) {
                result = -ENOMEM;
                goto end;
        }
-       memset(data.pointer, 0, data.length);
 
        status = acpi_extract_package(package, &format, &data);
        if (ACPI_FAILURE(status)) {
@@ -220,12 +219,11 @@ acpi_battery_get_status(struct acpi_battery *battery,
                goto end;
        }
 
-       data.pointer = kmalloc(data.length, GFP_KERNEL);
+       data.pointer = kzalloc(data.length, GFP_KERNEL);
        if (!data.pointer) {
                result = -ENOMEM;
                goto end;
        }
-       memset(data.pointer, 0, data.length);
 
        status = acpi_extract_package(package, &format, &data);
        if (ACPI_FAILURE(status)) {
@@ -694,10 +692,9 @@ static int acpi_battery_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL);
+       battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
        if (!battery)
                return -ENOMEM;
-       memset(battery, 0, sizeof(struct acpi_battery));
 
        battery->device = device;
        strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
index a15381789462d21bbcdcf0b7ccdc94508695acc2..0a1863ec91f3f78092d5c56c8bc2e59c0ed2961b 100644 (file)
@@ -96,11 +96,10 @@ static int acpi_container_add(struct acpi_device *device)
                return -EINVAL;
        }
 
-       container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
+       container = kzalloc(sizeof(struct acpi_container), GFP_KERNEL);
        if (!container)
                return -ENOMEM;
 
-       memset(container, 0, sizeof(struct acpi_container));
        container->handle = device->handle;
        strcpy(acpi_device_name(device), ACPI_CONTAINER_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
index 08c12588af6910cf98d236823463dc8fb105eb01..9c52d87d6f0439b2f50f1e519e2ecca289013efd 100644 (file)
@@ -624,10 +624,9 @@ static int acpi_ec_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
+       ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
        if (!ec)
                return -ENOMEM;
-       memset(ec, 0, sizeof(struct acpi_ec));
 
        ec->handle = device->handle;
        ec->uid = -1;
@@ -848,12 +847,11 @@ static int __init acpi_ec_fake_ecdt(void)
 
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Try to make an fake ECDT"));
 
-       ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
+       ec_ecdt = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
        if (!ec_ecdt) {
                ret = -ENOMEM;
                goto error;
        }
-       memset(ec_ecdt, 0, sizeof(struct acpi_ec));
 
        status = acpi_get_devices(ACPI_EC_HID,
                                  acpi_fake_ecdt_callback, NULL, NULL);
@@ -885,10 +883,9 @@ static int __init acpi_ec_get_real_ecdt(void)
        /*
         * Generate a temporary ec context to use until the namespace is scanned
         */
-       ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
+       ec_ecdt = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
        if (!ec_ecdt)
                return -ENOMEM;
-       memset(ec_ecdt, 0, sizeof(struct acpi_ec));
 
        mutex_init(&ec_ecdt->lock);
        if (acpi_ec_mode == EC_INTR) {
index c413e69fea8eb25633d4754ce69b9cd3dd9cf041..f305a826ca2df46c1db4b1bb940c987d885e3672 100644 (file)
@@ -186,10 +186,9 @@ static int acpi_fan_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       fan = kmalloc(sizeof(struct acpi_fan), GFP_KERNEL);
+       fan = kzalloc(sizeof(struct acpi_fan), GFP_KERNEL);
        if (!fan)
                return -ENOMEM;
-       memset(fan, 0, sizeof(struct acpi_fan));
 
        fan->device = device;
        strcpy(acpi_device_name(device), "Fan");
index 82e3e64483fbe8caff40d2590fc1235f09df78ba..8338be0990bce2854078bfef18e45ccef0836ca2 100644 (file)
@@ -309,18 +309,16 @@ static int acpi_ec_hc_add(struct acpi_device *device)
                return -EINVAL;
        }
 
-       ec_hc = kmalloc(sizeof(struct acpi_ec_hc), GFP_KERNEL);
+       ec_hc = kzalloc(sizeof(struct acpi_ec_hc), GFP_KERNEL);
        if (!ec_hc) {
                return -ENOMEM;
        }
-       memset(ec_hc, 0, sizeof(struct acpi_ec_hc));
 
-       smbus = kmalloc(sizeof(struct acpi_ec_smbus), GFP_KERNEL);
+       smbus = kzalloc(sizeof(struct acpi_ec_smbus), GFP_KERNEL);
        if (!smbus) {
                kfree(ec_hc);
                return -ENOMEM;
        }
-       memset(smbus, 0, sizeof(struct acpi_ec_smbus));
 
        ec_hc->handle = device->handle;
        strcpy(acpi_device_name(device), ACPI_EC_HC_DEVICE_NAME);
index 130cc8c37e226a227d1182cb77efe2678207f752..0e7682a88aa84d1a1df886fb04102e7864f32d50 100644 (file)
@@ -2516,13 +2516,12 @@ static int __init register_driver(struct ibm_struct *ibm)
 {
        int ret;
 
-       ibm->driver = kmalloc(sizeof(struct acpi_driver), GFP_KERNEL);
+       ibm->driver = kzalloc(sizeof(struct acpi_driver), GFP_KERNEL);
        if (!ibm->driver) {
                printk(IBM_ERR "kmalloc(ibm->driver) failed\n");
                return -1;
        }
 
-       memset(ibm->driver, 0, sizeof(struct acpi_driver));
        sprintf(ibm->driver->name, "%s_%s", IBM_NAME, ibm->name);
        ibm->driver->ids = ibm->hid;
        ibm->driver->ops.add = &ibm_device_add;
index 70b440f3f262546e1598ff4c0d943152014f6d1b..55f57a61c55e19bab562c331473ea9abee9bc89f 100644 (file)
@@ -122,19 +122,17 @@ int acpi_pci_bind(struct acpi_device *device)
        if (!device || !device->parent)
                return -EINVAL;
 
-       pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+       pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
                return -ENOMEM;
-       memset(pathname, 0, ACPI_PATHNAME_MAX);
        buffer.length = ACPI_PATHNAME_MAX;
        buffer.pointer = pathname;
 
-       data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
+       data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
        if (!data) {
                kfree(pathname);
                return -ENOMEM;
        }
-       memset(data, 0, sizeof(struct acpi_pci_data));
 
        acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
        ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
@@ -281,10 +279,9 @@ int acpi_pci_unbind(struct acpi_device *device)
        if (!device || !device->parent)
                return -EINVAL;
 
-       pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+       pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
                return -ENOMEM;
-       memset(pathname, 0, ACPI_PATHNAME_MAX);
 
        buffer.length = ACPI_PATHNAME_MAX;
        buffer.pointer = pathname;
@@ -331,11 +328,9 @@ acpi_pci_bind_root(struct acpi_device *device,
        char *pathname = NULL;
        struct acpi_buffer buffer = { 0, NULL };
 
-
-       pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+       pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
                return -ENOMEM;
-       memset(pathname, 0, ACPI_PATHNAME_MAX);
 
        buffer.length = ACPI_PATHNAME_MAX;
        buffer.pointer = pathname;
@@ -345,12 +340,11 @@ acpi_pci_bind_root(struct acpi_device *device,
                return -EINVAL;
        }
 
-       data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
+       data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
        if (!data) {
                kfree(pathname);
                return -ENOMEM;
        }
-       memset(data, 0, sizeof(struct acpi_pci_data));
 
        data->id = *id;
        data->bus = bus;
index 226892eaf987f192805571cddc6a567621b2cf6f..fe7d007833ade1b03ba2660269bcd10d42440c54 100644 (file)
@@ -89,10 +89,9 @@ acpi_pci_irq_add_entry(acpi_handle handle,
        if (!prt)
                return -EINVAL;
 
-       entry = kmalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
+       entry = kzalloc(sizeof(struct acpi_prt_entry), GFP_KERNEL);
        if (!entry)
                return -ENOMEM;
-       memset(entry, 0, sizeof(struct acpi_prt_entry));
 
        entry->id.segment = segment;
        entry->id.bus = bus;
@@ -161,10 +160,9 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
        static int first_time = 1;
 
 
-       pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+       pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
                return -ENOMEM;
-       memset(pathname, 0, ACPI_PATHNAME_MAX);
 
        if (first_time) {
                acpi_prt.count = 0;
@@ -198,11 +196,10 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
                return -ENODEV;
        }
 
-       prt = kmalloc(buffer.length, GFP_KERNEL);
+       prt = kzalloc(buffer.length, GFP_KERNEL);
        if (!prt) {
                return -ENOMEM;
        }
-       memset(prt, 0, buffer.length);
        buffer.pointer = prt;
 
        status = acpi_get_irq_routing_table(handle, &buffer);
index 812d733fe8167eeaf539f7a12094bf66c69dd2e1..481e633bbf41b33c16b6c7def7ff16e8252592ea 100644 (file)
@@ -307,11 +307,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
        if (!link || !irq)
                return -EINVAL;
 
-       resource = kmalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
+       resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
        if (!resource)
                return -ENOMEM;
 
-       memset(resource, 0, sizeof(*resource) + 1);
        buffer.length = sizeof(*resource) + 1;
        buffer.pointer = resource;
 
@@ -718,10 +717,9 @@ static int acpi_pci_link_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       link = kmalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
+       link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL);
        if (!link)
                return -ENOMEM;
-       memset(link, 0, sizeof(struct acpi_pci_link));
 
        link->device = device;
        strcpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
index b9c52cdbf6587bc641026b123cb0d82625b42493..a860efa2c562670768e447ada93eea69b03277d1 100644 (file)
@@ -165,10 +165,9 @@ static int acpi_pci_root_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       root = kmalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
+       root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
        if (!root)
                return -ENOMEM;
-       memset(root, 0, sizeof(struct acpi_pci_root));
        INIT_LIST_HEAD(&root->node);
 
        root->device = device;
index 23a8a9295578e9d408f0c238b56ff2f338b94f54..0ba7dfbbb2eebe47ad9f673d6151f605b503ef3a 100644 (file)
@@ -532,10 +532,9 @@ static int acpi_power_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
+       resource = kzalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
        if (!resource)
                return -ENOMEM;
-       memset(resource, 0, sizeof(struct acpi_power_resource));
 
        resource->device = device;
        strcpy(resource->name, device->pnp.bus_id);
index 89b3610feb47b6ea3f9317926cc6921b477b3440..25718fed39f1bf1f0124fb3e4f7c54203b6c1ff0 100644 (file)
@@ -615,10 +615,9 @@ static int acpi_processor_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       pr = kmalloc(sizeof(struct acpi_processor), GFP_KERNEL);
+       pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
        if (!pr)
                return -ENOMEM;
-       memset(pr, 0, sizeof(struct acpi_processor));
 
        pr->handle = device->handle;
        strcpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
index 2fb7533314cdfb57cc11b0ba89192766ddf06f7f..f58fc7447ab4ee8757885d869505a629ff4efa7a 100644 (file)
@@ -1576,12 +1576,11 @@ static int acpi_sbs_add(struct acpi_device *device)
        int id, cnt;
        acpi_status status = AE_OK;
 
-       sbs = kmalloc(sizeof(struct acpi_sbs), GFP_KERNEL);
+       sbs = kzalloc(sizeof(struct acpi_sbs), GFP_KERNEL);
        if (!sbs) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "kmalloc() failed\n"));
                return -ENOMEM;
        }
-       memset(sbs, 0, sizeof(struct acpi_sbs));
 
        cnt = 0;
        while (cnt < 10) {
index 698a1540e3033ce1960d4c72a45f3a8177397d94..283d87522c5ddc6c96b1569872eeb435e77b9ddc 100644 (file)
@@ -984,12 +984,11 @@ acpi_add_single_object(struct acpi_device **child,
        if (!child)
                return -EINVAL;
 
-       device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL);
+       device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
        if (!device) {
                printk(KERN_ERR PREFIX "Memory allocation error\n");
                return -ENOMEM;
        }
-       memset(device, 0, sizeof(struct acpi_device));
 
        device->handle = handle;
        device->parent = parent;
index 4d75085ca2d2e13ec89c2d6a131ec01c1d4c2310..40ddb4dd9631c20c6fc0d2695cb1126d6e9581b4 100644 (file)
@@ -902,12 +902,10 @@ acpi_thermal_write_trip_points(struct file *file,
        int i = 0;
 
 
-       limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
+       limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL);
        if (!limit_string)
                return -ENOMEM;
 
-       memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
-
        active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
        if (!active) {
                kfree(limit_string);
@@ -1271,10 +1269,9 @@ static int acpi_thermal_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
+       tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL);
        if (!tz)
                return -ENOMEM;
-       memset(tz, 0, sizeof(struct acpi_thermal));
 
        tz->device = device;
        strcpy(tz->name, device->pnp.bus_id);
index 91fed70a65a6dbe946e2b3370bd40d9223600b90..68a809fa7b19d06ef9f9457120d05fdbbecdb9b2 100644 (file)
@@ -262,11 +262,10 @@ acpi_evaluate_integer(acpi_handle handle,
        if (!data)
                return AE_BAD_PARAMETER;
 
-       element = kmalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
+       element = kzalloc(sizeof(union acpi_object), irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL);
        if (!element)
                return AE_NO_MEMORY;
 
-       memset(element, 0, sizeof(union acpi_object));
        buffer.length = sizeof(union acpi_object);
        buffer.pointer = element;
        status = acpi_evaluate_object(handle, pathname, arguments, &buffer);
@@ -321,12 +320,11 @@ acpi_evaluate_string(acpi_handle handle,
                return AE_BAD_DATA;
        }
 
-       *data = kmalloc(element->string.length + 1, GFP_KERNEL);
+       *data = kzalloc(element->string.length + 1, GFP_KERNEL);
        if (!data) {
                printk(KERN_ERR PREFIX "Memory allocation\n");
                return -ENOMEM;
        }
-       memset(*data, 0, element->string.length + 1);
 
        memcpy(*data, element->string.pointer, element->string.length);
 
index eb5141f9ef8f80a51e1ba1012e504bc7ff7ad9ae..36b37d755dbcc01339a29ced4c2f1b6516d27dbe 100644 (file)
@@ -533,11 +533,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
                int count = 0;
                union acpi_object *o;
 
-               br = kmalloc(sizeof(*br), GFP_KERNEL);
+               br = kzalloc(sizeof(*br), GFP_KERNEL);
                if (!br) {
                        printk(KERN_ERR "can't allocate memory\n");
                } else {
-                       memset(br, 0, sizeof(*br));
                        br->levels = kmalloc(obj->package.count *
                                             sizeof *(br->levels), GFP_KERNEL);
                        if (!br->levels)
@@ -1260,12 +1259,10 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
            acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
        if (ACPI_SUCCESS(status)) {
 
-               data = kmalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
+               data = kzalloc(sizeof(struct acpi_video_device), GFP_KERNEL);
                if (!data)
                        return -ENOMEM;
 
-               memset(data, 0, sizeof(struct acpi_video_device));
-
                strcpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
                strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
                acpi_driver_data(device) = data;
@@ -1718,10 +1715,9 @@ static int acpi_video_bus_add(struct acpi_device *device)
        if (!device)
                return -EINVAL;
 
-       video = kmalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
+       video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL);
        if (!video)
                return -ENOMEM;
-       memset(video, 0, sizeof(struct acpi_video_bus));
 
        video->device = device;
        strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
index bd40aee10e16442b585ee374fc01ef2df476798a..7f03881a8b682aa958f4919fa570fecfc1674c60 100644 (file)
@@ -319,13 +319,12 @@ static int ibm_get_table_from_acpi(char **bufp)
        if (bufp == NULL)
                goto read_table_done;
 
-       lbuf = kmalloc(size, GFP_KERNEL);
+       lbuf = kzalloc(size, GFP_KERNEL);
        dbg("%s: element count: %i, ASL table size: %i, &table = 0x%p\n",
                        __FUNCTION__, package->package.count, size, lbuf);
 
        if (lbuf) {
                *bufp = lbuf;
-               memset(lbuf, 0, size);
        } else {
                size = -ENOMEM;
                goto read_table_done;