aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsutils.c')
-rw-r--r--drivers/acpi/resources/rsutils.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c
index c5f7014929b4..9bcf0b637d22 100644
--- a/drivers/acpi/resources/rsutils.c
+++ b/drivers/acpi/resources/rsutils.c
@@ -299,7 +299,8 @@ static u16 acpi_rs_strcpy(char *destination, char *source)
299 * string_ptr - (optional) where to store the actual 299 * string_ptr - (optional) where to store the actual
300 * resource_source string 300 * resource_source string
301 * 301 *
302 * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit 302 * RETURN: Length of the string plus NULL terminator, rounded up to native
303 * word boundary
303 * 304 *
304 * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor 305 * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor
305 * to an internal resource descriptor 306 * to an internal resource descriptor
@@ -346,18 +347,16 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
346 } 347 }
347 348
348 /* 349 /*
349 * In order for the struct_size to fall on a 32-bit boundary, calculate 350 * In order for the Resource length to be a multiple of the native
350 * the length of the string (+1 for the NULL terminator) and expand the 351 * word, calculate the length of the string (+1 for NULL terminator)
351 * struct_size to the next 32-bit boundary. 352 * and expand to the next word multiple.
352 * 353 *
353 * Zero the entire area of the buffer. 354 * Zero the entire area of the buffer.
354 */ 355 */
355 total_length = 356 total_length =
356 (u32) 357 ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
357 ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN 358 1;
358 (ACPI_CAST_PTR 359 total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
359 (char,
360 &aml_resource_source[1])) + 1);
361 360
362 ACPI_MEMSET(resource_source->string_ptr, 0, total_length); 361 ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
363 362