[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / namespace / nsxfname.c
index cfd6937..1621ba9 100644 (file)
@@ -176,8 +176,6 @@ AcpiGetName (
     ACPI_BUFFER             *Buffer)
 {
     ACPI_STATUS             Status;
-    ACPI_NAMESPACE_NODE     *Node;
-    const char              *NodeName;
 
 
     /* Parameter validation */
@@ -193,16 +191,6 @@ AcpiGetName (
         return (Status);
     }
 
-    if (NameType == ACPI_FULL_PATHNAME ||
-        NameType == ACPI_FULL_PATHNAME_NO_TRAILING)
-    {
-        /* Get the full pathname (From the namespace root) */
-
-        Status = AcpiNsHandleToPathname (Handle, Buffer,
-            NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE);
-        return (Status);
-    }
-
     /*
      * Wants the single segment ACPI name.
      * Validate handle and convert to a namespace Node
@@ -213,30 +201,20 @@ AcpiGetName (
         return (Status);
     }
 
-    Node = AcpiNsValidateHandle (Handle);
-    if (!Node)
+    if (NameType == ACPI_FULL_PATHNAME ||
+        NameType == ACPI_FULL_PATHNAME_NO_TRAILING)
     {
-        Status = AE_BAD_PARAMETER;
-        goto UnlockAndExit;
-    }
-
-    /* Validate/Allocate/Clear caller buffer */
+        /* Get the full pathname (From the namespace root) */
 
-    Status = AcpiUtInitializeBuffer (Buffer, ACPI_PATH_SEGMENT_LENGTH);
-    if (ACPI_FAILURE (Status))
-    {
-        goto UnlockAndExit;
+        Status = AcpiNsHandleToPathname (Handle, Buffer,
+            NameType == ACPI_FULL_PATHNAME ? FALSE : TRUE);
     }
+    else
+    {
+        /* Get the single name */
 
-    /* Just copy the ACPI name from the Node and zero terminate it */
-
-    NodeName = AcpiUtGetNodeName (Node);
-    ACPI_MOVE_NAME (Buffer->Pointer, NodeName);
-    ((char *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0;
-    Status = AE_OK;
-
-
-UnlockAndExit:
+        Status = AcpiNsHandleToName (Handle, Buffer);
+    }
 
     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
     return (Status);