Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36bcbec7 authored by Burman Yan's avatar Burman Yan Committed by Len Brown
Browse files

ACPI: replace kmalloc+memset with kzalloc



Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 5b7b4119
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -276,12 +276,10 @@ acpi_cpufreq_cpu_init (


	dprintk("acpi_cpufreq_cpu_init\n");
	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)
	if (!data)
		return (-ENOMEM);
		return (-ENOMEM);


	memset(data, 0, sizeof(struct cpufreq_acpi_io));

	acpi_io_data[cpu] = data;
	acpi_io_data[cpu] = data;


	result = acpi_processor_register_performance(&data->acpi_data, cpu);
	result = acpi_processor_register_performance(&data->acpi_data, cpu);
+1 −2
Original line number Original line Diff line number Diff line
@@ -221,10 +221,9 @@ static int acpi_ac_add(struct acpi_device *device)
	if (!device)
	if (!device)
		return -EINVAL;
		return -EINVAL;


	ac = kmalloc(sizeof(struct acpi_ac), GFP_KERNEL);
	ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
	if (!ac)
	if (!ac)
		return -ENOMEM;
		return -ENOMEM;
	memset(ac, 0, sizeof(struct acpi_ac));


	ac->device = device;
	ac->device = device;
	strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
	strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
+1 −2
Original line number Original line Diff line number Diff line
@@ -395,10 +395,9 @@ static int acpi_memory_device_add(struct acpi_device *device)
	if (!device)
	if (!device)
		return -EINVAL;
		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)
	if (!mem_device)
		return -ENOMEM;
		return -ENOMEM;
	memset(mem_device, 0, sizeof(struct acpi_memory_device));


	INIT_LIST_HEAD(&mem_device->res_list);
	INIT_LIST_HEAD(&mem_device->res_list);
	mem_device->device = device;
	mem_device->device = device;
+1 −2
Original line number Original line Diff line number Diff line
@@ -1264,10 +1264,9 @@ static int asus_hotk_add(struct acpi_device *device)
	printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n",
	printk(KERN_NOTICE "Asus Laptop ACPI Extras version %s\n",
	       ASUS_ACPI_VERSION);
	       ASUS_ACPI_VERSION);


	hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL);
	hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL);
	if (!hotk)
	if (!hotk)
		return -ENOMEM;
		return -ENOMEM;
	memset(hotk, 0, sizeof(struct asus_hotk));


	hotk->handle = device->handle;
	hotk->handle = device->handle;
	strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME);
	strcpy(acpi_device_name(device), ACPI_HOTK_DEVICE_NAME);
+3 −6
Original line number Original line Diff line number Diff line
@@ -160,12 +160,11 @@ acpi_battery_get_info(struct acpi_battery *battery,
		goto end;
		goto end;
	}
	}


	data.pointer = kmalloc(data.length, GFP_KERNEL);
	data.pointer = kzalloc(data.length, GFP_KERNEL);
	if (!data.pointer) {
	if (!data.pointer) {
		result = -ENOMEM;
		result = -ENOMEM;
		goto end;
		goto end;
	}
	}
	memset(data.pointer, 0, data.length);


	status = acpi_extract_package(package, &format, &data);
	status = acpi_extract_package(package, &format, &data);
	if (ACPI_FAILURE(status)) {
	if (ACPI_FAILURE(status)) {
@@ -220,12 +219,11 @@ acpi_battery_get_status(struct acpi_battery *battery,
		goto end;
		goto end;
	}
	}


	data.pointer = kmalloc(data.length, GFP_KERNEL);
	data.pointer = kzalloc(data.length, GFP_KERNEL);
	if (!data.pointer) {
	if (!data.pointer) {
		result = -ENOMEM;
		result = -ENOMEM;
		goto end;
		goto end;
	}
	}
	memset(data.pointer, 0, data.length);


	status = acpi_extract_package(package, &format, &data);
	status = acpi_extract_package(package, &format, &data);
	if (ACPI_FAILURE(status)) {
	if (ACPI_FAILURE(status)) {
@@ -694,10 +692,9 @@ static int acpi_battery_add(struct acpi_device *device)
	if (!device)
	if (!device)
		return -EINVAL;
		return -EINVAL;


	battery = kmalloc(sizeof(struct acpi_battery), GFP_KERNEL);
	battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
	if (!battery)
	if (!battery)
		return -ENOMEM;
		return -ENOMEM;
	memset(battery, 0, sizeof(struct acpi_battery));


	battery->device = device;
	battery->device = device;
	strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
	strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
Loading