aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGary Hade <garyhade@us.ibm.com>2008-02-06 18:43:05 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-21 18:34:35 -0500
commit498fbb5d411fc8f6207c210796c9308bf54a51a5 (patch)
treed9f12f253e1b9339a4bc867cfadcc10b6a2f6722 /drivers
parente80af3a8dbbbf431b2070cc760699f01c5a6ac69 (diff)
PCI: hotplug: acpiphp_ibm: Remove get device information
drivers/pci/hotplug/acpiphp_ibm.c:ibm_find_acpi_device() is not large enough to accommodate data returned by the _CID method executed from acpi_get_object_info(). This patch eliminates the problem by letting ACPI code (instead of driver code) determine and obtain a correctly sized buffer. Signed-off-by: Gary Hade <garyhade@us.ibm.com> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/acpiphp_ibm.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
index 750ebd7a4c10..b0a22b92717e 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
@@ -395,33 +395,34 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle,
395{ 395{
396 acpi_handle *phandle = (acpi_handle *)context; 396 acpi_handle *phandle = (acpi_handle *)context;
397 acpi_status status; 397 acpi_status status;
398 struct acpi_device_info info; 398 struct acpi_device_info *info;
399 struct acpi_buffer info_buffer = { 399 struct acpi_buffer info_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
400 .length = sizeof(struct acpi_device_info), 400 int retval = 0;
401 .pointer = &info,
402 };
403 401
404 status = acpi_get_object_info(handle, &info_buffer); 402 status = acpi_get_object_info(handle, &info_buffer);
405 if (ACPI_FAILURE(status)) { 403 if (ACPI_FAILURE(status)) {
406 err("%s: Failed to get device information\n", __FUNCTION__); 404 err("%s: Failed to get device information status=0x%x\n",
407 return 0; 405 __FUNCTION__, status);
406 return retval;
408 } 407 }
409 info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; 408 info = info_buffer.pointer;
410 409 info->hardware_id.value[sizeof(info->hardware_id.value) - 1] = '\0';
411 if (info.current_status && (info.valid & ACPI_VALID_HID) && 410
412 (!strcmp(info.hardware_id.value, IBM_HARDWARE_ID1) || 411 if (info->current_status && (info->valid & ACPI_VALID_HID) &&
413 !strcmp(info.hardware_id.value, IBM_HARDWARE_ID2))) { 412 (!strcmp(info->hardware_id.value, IBM_HARDWARE_ID1) ||
414 dbg("found hardware: %s, handle: %p\n", info.hardware_id.value, 413 !strcmp(info->hardware_id.value, IBM_HARDWARE_ID2))) {
415 handle); 414 dbg("found hardware: %s, handle: %p\n",
415 info->hardware_id.value, handle);
416 *phandle = handle; 416 *phandle = handle;
417 /* returning non-zero causes the search to stop 417 /* returning non-zero causes the search to stop
418 * and returns this value to the caller of 418 * and returns this value to the caller of
419 * acpi_walk_namespace, but it also causes some warnings 419 * acpi_walk_namespace, but it also causes some warnings
420 * in the acpi debug code to print... 420 * in the acpi debug code to print...
421 */ 421 */
422 return FOUND_APCI; 422 retval = FOUND_APCI;
423 } 423 }
424 return 0; 424 kfree(info);
425 return retval;
425} 426}
426 427
427static int __init ibm_acpiphp_init(void) 428static int __init ibm_acpiphp_init(void)