]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ACPICA: Utilities: split hex detection into smaller functions
authorErik Schmauss <erik.schmauss@intel.com>
Fri, 10 Aug 2018 21:42:57 +0000 (14:42 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 14 Aug 2018 21:49:13 +0000 (23:49 +0200)
acpi_ut_implicit_strtoul64() called acpi_ut_detect_hex_prefix() and
ignored the return value. Instead, use acpi_ut_remove_hex_prefix().

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/utstrsuppt.c
drivers/acpi/acpica/utstrtoul64.c

index 2733cd4e418c49beb051f895a1b17037e65b37d0..3374d41582b53aaafec4334484f4085de2c4db76 100644 (file)
@@ -180,6 +180,8 @@ char acpi_ut_remove_leading_zeros(char **string);
 
 u8 acpi_ut_detect_hex_prefix(char **string);
 
+void acpi_ut_remove_hex_prefix(char **string);
+
 u8 acpi_ut_detect_octal_prefix(char **string);
 
 /*
index 954f8e3e35cda87e2f5aa95b247555b1f9f92354..05ff20049b875f2c0a504a7dd64bb7decc0a9919 100644 (file)
@@ -231,14 +231,34 @@ char acpi_ut_remove_whitespace(char **string)
 
 u8 acpi_ut_detect_hex_prefix(char **string)
 {
+       char *initial_position = *string;
 
+       acpi_ut_remove_hex_prefix(string);
+       if (*string != initial_position) {
+               return (TRUE);  /* String is past leading 0x */
+       }
+
+       return (FALSE);         /* Not a hex string */
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_ut_remove_hex_prefix
+ *
+ * PARAMETERS:  string                  - Pointer to input ASCII string
+ *
+ * RETURN:      none
+ *
+ * DESCRIPTION: Remove a hex "0x" prefix
+ *
+ ******************************************************************************/
+
+void acpi_ut_remove_hex_prefix(char **string)
+{
        if ((**string == ACPI_ASCII_ZERO) &&
            (tolower((int)*(*string + 1)) == 'x')) {
                *string += 2;   /* Go past the leading 0x */
-               return (TRUE);
        }
-
-       return (FALSE);         /* Not a hex string */
 }
 
 /*******************************************************************************
index 8fadad242db6dc54587383f51fd82e578ddcfa5a..5fde619a8bbdde9a8f0bb3f97c70d77461559463 100644 (file)
@@ -218,7 +218,7 @@ u64 acpi_ut_implicit_strtoul64(char *string)
         * implicit conversions, and the "0x" prefix is "not allowed".
         * However, allow a "0x" prefix as an ACPI extension.
         */
-       acpi_ut_detect_hex_prefix(&string);
+       acpi_ut_remove_hex_prefix(&string);
 
        if (!acpi_ut_remove_leading_zeros(&string)) {
                return_VALUE(0);