diff options
Diffstat (limited to 'drivers/acpi/utilities/utalloc.c')
-rw-r--r-- | drivers/acpi/utilities/utalloc.c | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 068450b36475..03b0044974c2 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 @@ | |||
47 | ACPI_MODULE_NAME("utalloc") | 47 | ACPI_MODULE_NAME("utalloc") |
48 | 48 | ||
49 | /* Local prototypes */ | 49 | /* Local prototypes */ |
50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); | 51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); |
52 | 52 | ||
53 | static acpi_status | 53 | static acpi_status |
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address, | |||
58 | static acpi_status | 58 | static acpi_status |
59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, | 59 | acpi_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 | ||
64 | static acpi_status | 62 | static acpi_status |
65 | acpi_ut_create_list(char *list_name, | 63 | acpi_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_ERROR((module, line, |
307 | ("ut_allocate: Attempt to allocate zero bytes\n")); | 305 | "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); |
308 | size = 1; | 306 | size = 1; |
309 | } | 307 | } |
310 | 308 | ||
@@ -312,9 +310,9 @@ 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_ERROR((module, line, |
316 | ("ut_allocate: Could not allocate size %X\n", | 314 | "ut_allocate: Could not allocate size %X", |
317 | (u32) size)); | 315 | (u32) size)); |
318 | 316 | ||
319 | return_PTR(NULL); | 317 | return_PTR(NULL); |
320 | } | 318 | } |
@@ -346,18 +344,17 @@ 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_ERROR((module, line, |
350 | ("ut_callocate: Attempt to allocate zero bytes\n")); | 348 | "Attempt to allocate zero bytes, allocating 1 byte")); |
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_ERROR((module, line, |
359 | ("ut_callocate: Could not allocate size %X\n", | 357 | "Could not allocate size %X", (u32) size)); |
360 | (u32) size)); | ||
361 | return_PTR(NULL); | 358 | return_PTR(NULL); |
362 | } | 359 | } |
363 | 360 | ||
@@ -482,9 +479,8 @@ void *acpi_ut_callocate_and_track(acpi_size size, | |||
482 | if (!allocation) { | 479 | if (!allocation) { |
483 | /* Report allocation error */ | 480 | /* Report allocation error */ |
484 | 481 | ||
485 | _ACPI_REPORT_ERROR(module, line, component, | 482 | ACPI_ERROR((module, line, |
486 | ("ut_callocate: Could not allocate size %X\n", | 483 | "Could not allocate size %X", (u32) size)); |
487 | (u32) size)); | ||
488 | return (NULL); | 484 | return (NULL); |
489 | } | 485 | } |
490 | 486 | ||
@@ -526,8 +522,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) | |||
526 | ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); | 522 | ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); |
527 | 523 | ||
528 | if (NULL == allocation) { | 524 | if (NULL == allocation) { |
529 | _ACPI_REPORT_ERROR(module, line, component, | 525 | ACPI_ERROR((module, line, "Attempt to delete a NULL address")); |
530 | ("acpi_ut_free: Attempt to delete a NULL address\n")); | ||
531 | 526 | ||
532 | return_VOID; | 527 | return_VOID; |
533 | } | 528 | } |
@@ -542,14 +537,11 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) | |||
542 | status = acpi_ut_remove_allocation(debug_block, | 537 | status = acpi_ut_remove_allocation(debug_block, |
543 | component, module, line); | 538 | component, module, line); |
544 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
545 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n", | 540 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); |
546 | acpi_format_exception(status))); | ||
547 | } | 541 | } |
548 | 542 | ||
549 | acpi_os_free(debug_block); | 543 | acpi_os_free(debug_block); |
550 | |||
551 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); | 544 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); |
552 | |||
553 | return_VOID; | 545 | return_VOID; |
554 | } | 546 | } |
555 | 547 | ||
@@ -626,10 +618,12 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, | |||
626 | */ | 618 | */ |
627 | element = acpi_ut_find_allocation(allocation); | 619 | element = acpi_ut_find_allocation(allocation); |
628 | if (element) { | 620 | if (element) { |
629 | ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); | 621 | ACPI_ERROR((AE_INFO, |
622 | "ut_track_allocation: Allocation already present in list! (%p)", | ||
623 | allocation)); | ||
630 | 624 | ||
631 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n", | 625 | ACPI_ERROR((AE_INFO, "Element %p Address %p", |
632 | element, allocation)); | 626 | element, allocation)); |
633 | 627 | ||
634 | goto unlock_and_exit; | 628 | goto unlock_and_exit; |
635 | } | 629 | } |
@@ -689,8 +683,8 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | |||
689 | if (NULL == mem_list->list_head) { | 683 | if (NULL == mem_list->list_head) { |
690 | /* No allocations! */ | 684 | /* No allocations! */ |
691 | 685 | ||
692 | _ACPI_REPORT_ERROR(module, line, component, | 686 | ACPI_ERROR((module, line, |
693 | ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); | 687 | "Empty allocation list, nothing to free!")); |
694 | 688 | ||
695 | return_ACPI_STATUS(AE_OK); | 689 | return_ACPI_STATUS(AE_OK); |
696 | } | 690 | } |
@@ -865,12 +859,11 @@ void acpi_ut_dump_allocations(u32 component, char *module) | |||
865 | /* Print summary */ | 859 | /* Print summary */ |
866 | 860 | ||
867 | if (!num_outstanding) { | 861 | if (!num_outstanding) { |
868 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 862 | ACPI_INFO((AE_INFO, "No outstanding allocations")); |
869 | "No outstanding allocations.\n")); | ||
870 | } else { | 863 | } else { |
871 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 864 | ACPI_ERROR((AE_INFO, |
872 | "%d(%X) Outstanding allocations\n", | 865 | "%d(%X) Outstanding allocations", |
873 | num_outstanding, num_outstanding)); | 866 | num_outstanding, num_outstanding)); |
874 | } | 867 | } |
875 | 868 | ||
876 | return_VOID; | 869 | return_VOID; |