diff options
Diffstat (limited to 'drivers/acpi/namespace/nsnames.c')
-rw-r--r-- | drivers/acpi/namespace/nsnames.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 549db42f16cf..bd5773878009 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -56,13 +56,14 @@ ACPI_MODULE_NAME("nsnames") | |||
56 | * Size - Size of the pathname | 56 | * Size - Size of the pathname |
57 | * *name_buffer - Where to return the pathname | 57 | * *name_buffer - Where to return the pathname |
58 | * | 58 | * |
59 | * RETURN: Places the pathname into the name_buffer, in external format | 59 | * RETURN: Status |
60 | * Places the pathname into the name_buffer, in external format | ||
60 | * (name segments separated by path separators) | 61 | * (name segments separated by path separators) |
61 | * | 62 | * |
62 | * DESCRIPTION: Generate a full pathaname | 63 | * DESCRIPTION: Generate a full pathaname |
63 | * | 64 | * |
64 | ******************************************************************************/ | 65 | ******************************************************************************/ |
65 | void | 66 | acpi_status |
66 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | 67 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
67 | acpi_size size, char *name_buffer) | 68 | acpi_size size, char *name_buffer) |
68 | { | 69 | { |
@@ -77,7 +78,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
77 | if (index < ACPI_NAME_SIZE) { | 78 | if (index < ACPI_NAME_SIZE) { |
78 | name_buffer[0] = AML_ROOT_PREFIX; | 79 | name_buffer[0] = AML_ROOT_PREFIX; |
79 | name_buffer[1] = 0; | 80 | name_buffer[1] = 0; |
80 | return; | 81 | return (AE_OK); |
81 | } | 82 | } |
82 | 83 | ||
83 | /* Store terminator byte, then build name backwards */ | 84 | /* Store terminator byte, then build name backwards */ |
@@ -105,11 +106,13 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
105 | 106 | ||
106 | if (index != 0) { | 107 | if (index != 0) { |
107 | ACPI_ERROR((AE_INFO, | 108 | ACPI_ERROR((AE_INFO, |
108 | "Could not construct pathname; index=%X, size=%X, Path=%s", | 109 | "Could not construct external pathname; index=%X, size=%X, Path=%s", |
109 | (u32) index, (u32) size, &name_buffer[size])); | 110 | (u32) index, (u32) size, &name_buffer[size])); |
111 | |||
112 | return (AE_BAD_PARAMETER); | ||
110 | } | 113 | } |
111 | 114 | ||
112 | return; | 115 | return (AE_OK); |
113 | } | 116 | } |
114 | 117 | ||
115 | #ifdef ACPI_DEBUG_OUTPUT | 118 | #ifdef ACPI_DEBUG_OUTPUT |
@@ -129,6 +132,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
129 | 132 | ||
130 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | 133 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) |
131 | { | 134 | { |
135 | acpi_status status; | ||
132 | char *name_buffer; | 136 | char *name_buffer; |
133 | acpi_size size; | 137 | acpi_size size; |
134 | 138 | ||
@@ -138,8 +142,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
138 | 142 | ||
139 | size = acpi_ns_get_pathname_length(node); | 143 | size = acpi_ns_get_pathname_length(node); |
140 | if (!size) { | 144 | if (!size) { |
141 | ACPI_ERROR((AE_INFO, "Invalid node failure")); | 145 | return (NULL); |
142 | return_PTR(NULL); | ||
143 | } | 146 | } |
144 | 147 | ||
145 | /* Allocate a buffer to be returned to caller */ | 148 | /* Allocate a buffer to be returned to caller */ |
@@ -152,7 +155,11 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
152 | 155 | ||
153 | /* Build the path in the allocated buffer */ | 156 | /* Build the path in the allocated buffer */ |
154 | 157 | ||
155 | acpi_ns_build_external_path(node, size, name_buffer); | 158 | status = acpi_ns_build_external_path(node, size, name_buffer); |
159 | if (ACPI_FAILURE(status)) { | ||
160 | return (NULL); | ||
161 | } | ||
162 | |||
156 | return_PTR(name_buffer); | 163 | return_PTR(name_buffer); |
157 | } | 164 | } |
158 | #endif | 165 | #endif |
@@ -186,7 +193,7 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) | |||
186 | while (next_node && (next_node != acpi_gbl_root_node)) { | 193 | while (next_node && (next_node != acpi_gbl_root_node)) { |
187 | if (ACPI_GET_DESCRIPTOR_TYPE(next_node) != ACPI_DESC_TYPE_NAMED) { | 194 | if (ACPI_GET_DESCRIPTOR_TYPE(next_node) != ACPI_DESC_TYPE_NAMED) { |
188 | ACPI_ERROR((AE_INFO, | 195 | ACPI_ERROR((AE_INFO, |
189 | "Invalid NS Node (%p) while traversing path", | 196 | "Invalid Namespace Node (%p) while traversing namespace", |
190 | next_node)); | 197 | next_node)); |
191 | return 0; | 198 | return 0; |
192 | } | 199 | } |
@@ -234,8 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
234 | 241 | ||
235 | required_size = acpi_ns_get_pathname_length(node); | 242 | required_size = acpi_ns_get_pathname_length(node); |
236 | if (!required_size) { | 243 | if (!required_size) { |
237 | ACPI_ERROR((AE_INFO, "Invalid node failure")); | 244 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
238 | return_ACPI_STATUS(AE_ERROR); | ||
239 | } | 245 | } |
240 | 246 | ||
241 | /* Validate/Allocate/Clear caller buffer */ | 247 | /* Validate/Allocate/Clear caller buffer */ |
@@ -247,7 +253,11 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
247 | 253 | ||
248 | /* Build the path in the caller buffer */ | 254 | /* Build the path in the caller buffer */ |
249 | 255 | ||
250 | acpi_ns_build_external_path(node, required_size, buffer->pointer); | 256 | status = |
257 | acpi_ns_build_external_path(node, required_size, buffer->pointer); | ||
258 | if (ACPI_FAILURE(status)) { | ||
259 | return_ACPI_STATUS(status); | ||
260 | } | ||
251 | 261 | ||
252 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", | 262 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n", |
253 | (char *)buffer->pointer, (u32) required_size)); | 263 | (char *)buffer->pointer, (u32) required_size)); |