aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_bind.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_bind.c')
-rw-r--r--drivers/acpi/pci_bind.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/acpi/pci_bind.c b/drivers/acpi/pci_bind.c
index 70b440f3f262..55f57a61c55e 100644
--- a/drivers/acpi/pci_bind.c
+++ b/drivers/acpi/pci_bind.c
@@ -122,19 +122,17 @@ int acpi_pci_bind(struct acpi_device *device)
122 if (!device || !device->parent) 122 if (!device || !device->parent)
123 return -EINVAL; 123 return -EINVAL;
124 124
125 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 125 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
126 if (!pathname) 126 if (!pathname)
127 return -ENOMEM; 127 return -ENOMEM;
128 memset(pathname, 0, ACPI_PATHNAME_MAX);
129 buffer.length = ACPI_PATHNAME_MAX; 128 buffer.length = ACPI_PATHNAME_MAX;
130 buffer.pointer = pathname; 129 buffer.pointer = pathname;
131 130
132 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 131 data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
133 if (!data) { 132 if (!data) {
134 kfree(pathname); 133 kfree(pathname);
135 return -ENOMEM; 134 return -ENOMEM;
136 } 135 }
137 memset(data, 0, sizeof(struct acpi_pci_data));
138 136
139 acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); 137 acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
140 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n", 138 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
@@ -281,10 +279,9 @@ int acpi_pci_unbind(struct acpi_device *device)
281 if (!device || !device->parent) 279 if (!device || !device->parent)
282 return -EINVAL; 280 return -EINVAL;
283 281
284 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL); 282 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
285 if (!pathname) 283 if (!pathname)
286 return -ENOMEM; 284 return -ENOMEM;
287 memset(pathname, 0, ACPI_PATHNAME_MAX);
288 285
289 buffer.length = ACPI_PATHNAME_MAX; 286 buffer.length = ACPI_PATHNAME_MAX;
290 buffer.pointer = pathname; 287 buffer.pointer = pathname;
@@ -331,11 +328,9 @@ acpi_pci_bind_root(struct acpi_device *device,
331 char *pathname = NULL; 328 char *pathname = NULL;
332 struct acpi_buffer buffer = { 0, NULL }; 329 struct acpi_buffer buffer = { 0, NULL };
333 330
334 331 pathname = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
335 pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
336 if (!pathname) 332 if (!pathname)
337 return -ENOMEM; 333 return -ENOMEM;
338 memset(pathname, 0, ACPI_PATHNAME_MAX);
339 334
340 buffer.length = ACPI_PATHNAME_MAX; 335 buffer.length = ACPI_PATHNAME_MAX;
341 buffer.pointer = pathname; 336 buffer.pointer = pathname;
@@ -345,12 +340,11 @@ acpi_pci_bind_root(struct acpi_device *device,
345 return -EINVAL; 340 return -EINVAL;
346 } 341 }
347 342
348 data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL); 343 data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
349 if (!data) { 344 if (!data) {
350 kfree(pathname); 345 kfree(pathname);
351 return -ENOMEM; 346 return -ENOMEM;
352 } 347 }
353 memset(data, 0, sizeof(struct acpi_pci_data));
354 348
355 data->id = *id; 349 data->id = *id;
356 data->bus = bus; 350 data->bus = bus;