aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utalloc.c')
-rw-r--r--drivers/acpi/utilities/utalloc.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 068450b36475..0efcbdf7e620 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
47ACPI_MODULE_NAME("utalloc") 47ACPI_MODULE_NAME("utalloc")
48 48
49/* Local prototypes */ 49/* Local prototypes */
50#ifdef ACPI_DBG_TRACK_ALLOCATIONS 50#ifdef ACPI_DBG_TRACK_ALLOCATIONS
51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); 51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
52 52
53static acpi_status 53static acpi_status
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
58static acpi_status 58static acpi_status
59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, 59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
60 u32 component, char *module, u32 line); 60 u32 component, char *module, u32 line);
61#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
62 61
63#ifdef ACPI_DBG_TRACK_ALLOCATIONS
64static acpi_status 62static acpi_status
65acpi_ut_create_list(char *list_name, 63acpi_ut_create_list(char *list_name,
66 u16 object_size, struct acpi_memory_list **return_cache); 64 u16 object_size, struct acpi_memory_list **return_cache);
@@ -303,8 +301,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
303 /* Check for an inadvertent size of zero bytes */ 301 /* Check for an inadvertent size of zero bytes */
304 302
305 if (!size) { 303 if (!size) {
306 _ACPI_REPORT_ERROR(module, line, component, 304 _ACPI_REPORT_ERROR(module, line,
307 ("ut_allocate: Attempt to allocate zero bytes\n")); 305 ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
308 size = 1; 306 size = 1;
309 } 307 }
310 308
@@ -312,7 +310,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
312 if (!allocation) { 310 if (!allocation) {
313 /* Report allocation error */ 311 /* Report allocation error */
314 312
315 _ACPI_REPORT_ERROR(module, line, component, 313 _ACPI_REPORT_ERROR(module, line,
316 ("ut_allocate: Could not allocate size %X\n", 314 ("ut_allocate: Could not allocate size %X\n",
317 (u32) size)); 315 (u32) size));
318 316
@@ -346,16 +344,16 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
346 /* Check for an inadvertent size of zero bytes */ 344 /* Check for an inadvertent size of zero bytes */
347 345
348 if (!size) { 346 if (!size) {
349 _ACPI_REPORT_ERROR(module, line, component, 347 _ACPI_REPORT_ERROR(module, line,
350 ("ut_callocate: Attempt to allocate zero bytes\n")); 348 ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
351 return_PTR(NULL); 349 size = 1;
352 } 350 }
353 351
354 allocation = acpi_os_allocate(size); 352 allocation = acpi_os_allocate(size);
355 if (!allocation) { 353 if (!allocation) {
356 /* Report allocation error */ 354 /* Report allocation error */
357 355
358 _ACPI_REPORT_ERROR(module, line, component, 356 _ACPI_REPORT_ERROR(module, line,
359 ("ut_callocate: Could not allocate size %X\n", 357 ("ut_callocate: Could not allocate size %X\n",
360 (u32) size)); 358 (u32) size));
361 return_PTR(NULL); 359 return_PTR(NULL);
@@ -482,7 +480,7 @@ void *acpi_ut_callocate_and_track(acpi_size size,
482 if (!allocation) { 480 if (!allocation) {
483 /* Report allocation error */ 481 /* Report allocation error */
484 482
485 _ACPI_REPORT_ERROR(module, line, component, 483 _ACPI_REPORT_ERROR(module, line,
486 ("ut_callocate: Could not allocate size %X\n", 484 ("ut_callocate: Could not allocate size %X\n",
487 (u32) size)); 485 (u32) size));
488 return (NULL); 486 return (NULL);
@@ -526,7 +524,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
526 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); 524 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
527 525
528 if (NULL == allocation) { 526 if (NULL == allocation) {
529 _ACPI_REPORT_ERROR(module, line, component, 527 _ACPI_REPORT_ERROR(module, line,
530 ("acpi_ut_free: Attempt to delete a NULL address\n")); 528 ("acpi_ut_free: Attempt to delete a NULL address\n"));
531 529
532 return_VOID; 530 return_VOID;
@@ -542,8 +540,8 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
542 status = acpi_ut_remove_allocation(debug_block, 540 status = acpi_ut_remove_allocation(debug_block,
543 component, module, line); 541 component, module, line);
544 if (ACPI_FAILURE(status)) { 542 if (ACPI_FAILURE(status)) {
545 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", 543 ACPI_REPORT_ERROR(("Could not free memory, %s\n",
546 acpi_format_exception(status))); 544 acpi_format_exception(status)));
547 } 545 }
548 546
549 acpi_os_free(debug_block); 547 acpi_os_free(debug_block);
@@ -628,8 +626,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
628 if (element) { 626 if (element) {
629 ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); 627 ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation));
630 628
631 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", 629 ACPI_REPORT_ERROR(("Element %p Address %p\n",
632 element, allocation)); 630 element, allocation));
633 631
634 goto unlock_and_exit; 632 goto unlock_and_exit;
635 } 633 }
@@ -689,7 +687,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
689 if (NULL == mem_list->list_head) { 687 if (NULL == mem_list->list_head) {
690 /* No allocations! */ 688 /* No allocations! */
691 689
692 _ACPI_REPORT_ERROR(module, line, component, 690 _ACPI_REPORT_ERROR(module, line,
693 ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); 691 ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
694 692
695 return_ACPI_STATUS(AE_OK); 693 return_ACPI_STATUS(AE_OK);
@@ -865,12 +863,10 @@ void acpi_ut_dump_allocations(u32 component, char *module)
865 /* Print summary */ 863 /* Print summary */
866 864
867 if (!num_outstanding) { 865 if (!num_outstanding) {
868 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 866 ACPI_REPORT_INFO(("No outstanding allocations\n"));
869 "No outstanding allocations.\n"));
870 } else { 867 } else {
871 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 868 ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n",
872 "%d(%X) Outstanding allocations\n", 869 num_outstanding, num_outstanding));
873 num_outstanding, num_outstanding));
874 } 870 }
875 871
876 return_VOID; 872 return_VOID;