diff options
Diffstat (limited to 'drivers/acpi/acpica/uttrack.c')
-rw-r--r-- | drivers/acpi/acpica/uttrack.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c index 160f13f4aab5..c0027773cccb 100644 --- a/drivers/acpi/acpica/uttrack.c +++ b/drivers/acpi/acpica/uttrack.c | |||
@@ -130,10 +130,23 @@ void *acpi_ut_allocate_and_track(acpi_size size, | |||
130 | struct acpi_debug_mem_block *allocation; | 130 | struct acpi_debug_mem_block *allocation; |
131 | acpi_status status; | 131 | acpi_status status; |
132 | 132 | ||
133 | /* Check for an inadvertent size of zero bytes */ | ||
134 | |||
135 | if (!size) { | ||
136 | ACPI_WARNING((module, line, | ||
137 | "Attempt to allocate zero bytes, allocating 1 byte")); | ||
138 | size = 1; | ||
139 | } | ||
140 | |||
133 | allocation = | 141 | allocation = |
134 | acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), | 142 | acpi_os_allocate(size + sizeof(struct acpi_debug_mem_header)); |
135 | component, module, line); | ||
136 | if (!allocation) { | 143 | if (!allocation) { |
144 | |||
145 | /* Report allocation error */ | ||
146 | |||
147 | ACPI_WARNING((module, line, | ||
148 | "Could not allocate size %u", (u32)size)); | ||
149 | |||
137 | return (NULL); | 150 | return (NULL); |
138 | } | 151 | } |
139 | 152 | ||
@@ -179,9 +192,17 @@ void *acpi_ut_allocate_zeroed_and_track(acpi_size size, | |||
179 | struct acpi_debug_mem_block *allocation; | 192 | struct acpi_debug_mem_block *allocation; |
180 | acpi_status status; | 193 | acpi_status status; |
181 | 194 | ||
195 | /* Check for an inadvertent size of zero bytes */ | ||
196 | |||
197 | if (!size) { | ||
198 | ACPI_WARNING((module, line, | ||
199 | "Attempt to allocate zero bytes, allocating 1 byte")); | ||
200 | size = 1; | ||
201 | } | ||
202 | |||
182 | allocation = | 203 | allocation = |
183 | acpi_ut_allocate_zeroed(size + sizeof(struct acpi_debug_mem_header), | 204 | acpi_os_allocate_zeroed(size + |
184 | component, module, line); | 205 | sizeof(struct acpi_debug_mem_header)); |
185 | if (!allocation) { | 206 | if (!allocation) { |
186 | 207 | ||
187 | /* Report allocation error */ | 208 | /* Report allocation error */ |
@@ -409,7 +430,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, | |||
409 | element->next = allocation; | 430 | element->next = allocation; |
410 | } | 431 | } |
411 | 432 | ||
412 | unlock_and_exit: | 433 | unlock_and_exit: |
413 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | 434 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); |
414 | return_ACPI_STATUS(status); | 435 | return_ACPI_STATUS(status); |
415 | } | 436 | } |