[ACPI] ACPICA 20060113
[deliverable/linux.git] / drivers / acpi / utilities / utalloc.c
index 068450b36475a8b9b3552594bfcfbbf1409f87b0..0efcbdf7e620ac554ef4372ef12f3bc83bb990c3 100644 (file)
@@ -5,7 +5,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@
 ACPI_MODULE_NAME("utalloc")
 
 /* Local prototypes */
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
 
 static acpi_status
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
 static acpi_status
 acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
                          u32 component, char *module, u32 line);
-#endif                         /* ACPI_DBG_TRACK_ALLOCATIONS */
 
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 static acpi_status
 acpi_ut_create_list(char *list_name,
                    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)
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_allocate: Attempt to allocate zero bytes\n"));
+               _ACPI_REPORT_ERROR(module, line,
+                                  ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
                size = 1;
        }
 
@@ -312,7 +310,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR(module, line, component,
+               _ACPI_REPORT_ERROR(module, line,
                                   ("ut_allocate: Could not allocate size %X\n",
                                    (u32) size));
 
@@ -346,16 +344,16 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
        /* Check for an inadvertent size of zero bytes */
 
        if (!size) {
-               _ACPI_REPORT_ERROR(module, line, component,
-                                  ("ut_callocate: Attempt to allocate zero bytes\n"));
-               return_PTR(NULL);
+               _ACPI_REPORT_ERROR(module, line,
+                                  ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
+               size = 1;
        }
 
        allocation = acpi_os_allocate(size);
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR(module, line, component,
+               _ACPI_REPORT_ERROR(module, line,
                                   ("ut_callocate: Could not allocate size %X\n",
                                    (u32) size));
                return_PTR(NULL);
@@ -482,7 +480,7 @@ void *acpi_ut_callocate_and_track(acpi_size size,
        if (!allocation) {
                /* Report allocation error */
 
-               _ACPI_REPORT_ERROR(module, line, component,
+               _ACPI_REPORT_ERROR(module, line,
                                   ("ut_callocate: Could not allocate size %X\n",
                                    (u32) size));
                return (NULL);
@@ -526,7 +524,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
        ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
 
        if (NULL == allocation) {
-               _ACPI_REPORT_ERROR(module, line, component,
+               _ACPI_REPORT_ERROR(module, line,
                                   ("acpi_ut_free: Attempt to delete a NULL address\n"));
 
                return_VOID;
@@ -542,8 +540,8 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
        status = acpi_ut_remove_allocation(debug_block,
                                           component, module, line);
        if (ACPI_FAILURE(status)) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not free memory, %s\n",
-                                 acpi_format_exception(status)));
+               ACPI_REPORT_ERROR(("Could not free memory, %s\n",
+                                  acpi_format_exception(status)));
        }
 
        acpi_os_free(debug_block);
@@ -628,8 +626,8 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
        if (element) {
                ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation));
 
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Element %p Address %p\n",
-                                 element, allocation));
+               ACPI_REPORT_ERROR(("Element %p Address %p\n",
+                                  element, allocation));
 
                goto unlock_and_exit;
        }
@@ -689,7 +687,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
        if (NULL == mem_list->list_head) {
                /* No allocations! */
 
-               _ACPI_REPORT_ERROR(module, line, component,
+               _ACPI_REPORT_ERROR(module, line,
                                   ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
 
                return_ACPI_STATUS(AE_OK);
@@ -865,12 +863,10 @@ void acpi_ut_dump_allocations(u32 component, char *module)
        /* Print summary */
 
        if (!num_outstanding) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "No outstanding allocations.\n"));
+               ACPI_REPORT_INFO(("No outstanding allocations\n"));
        } else {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                 "%d(%X) Outstanding allocations\n",
-                                 num_outstanding, num_outstanding));
+               ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n",
+                                  num_outstanding, num_outstanding));
        }
 
        return_VOID;
This page took 0.028508 seconds and 5 git commands to generate.