diff options
author | Bob Moore <robert.moore@intel.com> | 2010-01-20 20:08:31 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-01-22 12:30:02 -0500 |
commit | 2147d3f00f85c9e993786863d8138694672da01b (patch) | |
tree | 446fe7d97ded336fbc5c8d8cad9ad87b959a6588 /drivers/acpi | |
parent | 92dcffb916d309aa01778bf8963a6932e4014d07 (diff) |
ACPICA: Update for new gcc-4 warning options
Added several new options for the gcc-4 generation, and updated
the source accordingly. This includes some code restructuring to
eliminate unreachable code, elimination of some gotos, elimination
of unused return values, and some additional casting.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpica/exconfig.c | 13 | ||||
-rw-r--r-- | drivers/acpi/acpica/hwgpe.c | 6 | ||||
-rw-r--r-- | drivers/acpi/acpica/nspredef.c | 24 | ||||
-rw-r--r-- | drivers/acpi/acpica/nsrepair2.c | 24 | ||||
-rw-r--r-- | drivers/acpi/acpica/utmutex.c | 16 |
5 files changed, 30 insertions, 53 deletions
diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index 46adfa541cbc..2ea8daccba1c 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c | |||
@@ -490,7 +490,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
490 | 490 | ||
491 | status = acpi_tb_add_table(&table_desc, &table_index); | 491 | status = acpi_tb_add_table(&table_desc, &table_index); |
492 | if (ACPI_FAILURE(status)) { | 492 | if (ACPI_FAILURE(status)) { |
493 | goto cleanup; | 493 | |
494 | /* Delete allocated table buffer */ | ||
495 | |||
496 | acpi_tb_delete_table(&table_desc); | ||
497 | return_ACPI_STATUS(status); | ||
494 | } | 498 | } |
495 | 499 | ||
496 | /* | 500 | /* |
@@ -533,13 +537,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
533 | acpi_gbl_table_handler_context); | 537 | acpi_gbl_table_handler_context); |
534 | } | 538 | } |
535 | 539 | ||
536 | cleanup: | ||
537 | if (ACPI_FAILURE(status)) { | ||
538 | |||
539 | /* Delete allocated table buffer */ | ||
540 | |||
541 | acpi_tb_delete_table(&table_desc); | ||
542 | } | ||
543 | return_ACPI_STATUS(status); | 540 | return_ACPI_STATUS(status); |
544 | } | 541 | } |
545 | 542 | ||
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index c28c41b3180b..55c4507957bb 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c | |||
@@ -224,7 +224,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
224 | 224 | ||
225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); | 225 | status = acpi_hw_read(&in_byte, &gpe_register_info->status_address); |
226 | if (ACPI_FAILURE(status)) { | 226 | if (ACPI_FAILURE(status)) { |
227 | goto unlock_and_exit; | 227 | return (status); |
228 | } | 228 | } |
229 | 229 | ||
230 | if (register_bit & in_byte) { | 230 | if (register_bit & in_byte) { |
@@ -234,9 +234,7 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info, | |||
234 | /* Set return value */ | 234 | /* Set return value */ |
235 | 235 | ||
236 | (*event_status) = local_event_status; | 236 | (*event_status) = local_event_status; |
237 | 237 | return (AE_OK); | |
238 | unlock_and_exit: | ||
239 | return (status); | ||
240 | } | 238 | } |
241 | 239 | ||
242 | /****************************************************************************** | 240 | /****************************************************************************** |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d34fa59548f7..309586f5809c 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
@@ -1000,27 +1000,25 @@ acpi_ns_check_object_type(struct acpi_predefined_data *data, | |||
1000 | 1000 | ||
1001 | /* Is the object one of the expected types? */ | 1001 | /* Is the object one of the expected types? */ |
1002 | 1002 | ||
1003 | if (!(return_btype & expected_btypes)) { | 1003 | if (return_btype & expected_btypes) { |
1004 | 1004 | ||
1005 | /* Type mismatch -- attempt repair of the returned object */ | 1005 | /* For reference objects, check that the reference type is correct */ |
1006 | 1006 | ||
1007 | status = acpi_ns_repair_object(data, expected_btypes, | 1007 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { |
1008 | package_index, | 1008 | status = acpi_ns_check_reference(data, return_object); |
1009 | return_object_ptr); | ||
1010 | if (ACPI_SUCCESS(status)) { | ||
1011 | return (AE_OK); /* Repair was successful */ | ||
1012 | } | 1009 | } |
1013 | goto type_error_exit; | 1010 | |
1011 | return (status); | ||
1014 | } | 1012 | } |
1015 | 1013 | ||
1016 | /* For reference objects, check that the reference type is correct */ | 1014 | /* Type mismatch -- attempt repair of the returned object */ |
1017 | 1015 | ||
1018 | if (return_object->common.type == ACPI_TYPE_LOCAL_REFERENCE) { | 1016 | status = acpi_ns_repair_object(data, expected_btypes, |
1019 | status = acpi_ns_check_reference(data, return_object); | 1017 | package_index, return_object_ptr); |
1018 | if (ACPI_SUCCESS(status)) { | ||
1019 | return (AE_OK); /* Repair was successful */ | ||
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | return (status); | ||
1023 | |||
1024 | type_error_exit: | 1022 | type_error_exit: |
1025 | 1023 | ||
1026 | /* Create a string with all expected types for this predefined object */ | 1024 | /* Create a string with all expected types for this predefined object */ |
diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index f13691c1cca5..6d6926466a08 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c | |||
@@ -93,7 +93,7 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
93 | u32 sort_index, | 93 | u32 sort_index, |
94 | u8 sort_direction, char *sort_key_name); | 94 | u8 sort_direction, char *sort_key_name); |
95 | 95 | ||
96 | static acpi_status | 96 | static void |
97 | acpi_ns_sort_list(union acpi_operand_object **elements, | 97 | acpi_ns_sort_list(union acpi_operand_object **elements, |
98 | u32 count, u32 index, u8 sort_direction); | 98 | u32 count, u32 index, u8 sort_direction); |
99 | 99 | ||
@@ -443,7 +443,6 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
443 | union acpi_operand_object *obj_desc; | 443 | union acpi_operand_object *obj_desc; |
444 | u32 i; | 444 | u32 i; |
445 | u32 previous_value; | 445 | u32 previous_value; |
446 | acpi_status status; | ||
447 | 446 | ||
448 | ACPI_FUNCTION_NAME(ns_check_sorted_list); | 447 | ACPI_FUNCTION_NAME(ns_check_sorted_list); |
449 | 448 | ||
@@ -494,19 +493,15 @@ acpi_ns_check_sorted_list(struct acpi_predefined_data *data, | |||
494 | 493 | ||
495 | /* | 494 | /* |
496 | * The list must be sorted in the specified order. If we detect a | 495 | * The list must be sorted in the specified order. If we detect a |
497 | * discrepancy, issue a warning and sort the entire list | 496 | * discrepancy, sort the entire list. |
498 | */ | 497 | */ |
499 | if (((sort_direction == ACPI_SORT_ASCENDING) && | 498 | if (((sort_direction == ACPI_SORT_ASCENDING) && |
500 | (obj_desc->integer.value < previous_value)) || | 499 | (obj_desc->integer.value < previous_value)) || |
501 | ((sort_direction == ACPI_SORT_DESCENDING) && | 500 | ((sort_direction == ACPI_SORT_DESCENDING) && |
502 | (obj_desc->integer.value > previous_value))) { | 501 | (obj_desc->integer.value > previous_value))) { |
503 | status = | 502 | acpi_ns_sort_list(return_object->package.elements, |
504 | acpi_ns_sort_list(return_object->package.elements, | 503 | outer_element_count, sort_index, |
505 | outer_element_count, sort_index, | 504 | sort_direction); |
506 | sort_direction); | ||
507 | if (ACPI_FAILURE(status)) { | ||
508 | return (status); | ||
509 | } | ||
510 | 505 | ||
511 | data->flags |= ACPI_OBJECT_REPAIRED; | 506 | data->flags |= ACPI_OBJECT_REPAIRED; |
512 | 507 | ||
@@ -615,15 +610,16 @@ acpi_ns_remove_null_elements(struct acpi_predefined_data *data, | |||
615 | * Index - Sort by which package element | 610 | * Index - Sort by which package element |
616 | * sort_direction - Ascending or Descending sort | 611 | * sort_direction - Ascending or Descending sort |
617 | * | 612 | * |
618 | * RETURN: Status | 613 | * RETURN: None |
619 | * | 614 | * |
620 | * DESCRIPTION: Sort the objects that are in a package element list. | 615 | * DESCRIPTION: Sort the objects that are in a package element list. |
621 | * | 616 | * |
622 | * NOTE: Assumes that all NULL elements have been removed from the package. | 617 | * NOTE: Assumes that all NULL elements have been removed from the package, |
618 | * and that all elements have been verified to be of type Integer. | ||
623 | * | 619 | * |
624 | *****************************************************************************/ | 620 | *****************************************************************************/ |
625 | 621 | ||
626 | static acpi_status | 622 | static void |
627 | acpi_ns_sort_list(union acpi_operand_object **elements, | 623 | acpi_ns_sort_list(union acpi_operand_object **elements, |
628 | u32 count, u32 index, u8 sort_direction) | 624 | u32 count, u32 index, u8 sort_direction) |
629 | { | 625 | { |
@@ -652,6 +648,4 @@ acpi_ns_sort_list(union acpi_operand_object **elements, | |||
652 | } | 648 | } |
653 | } | 649 | } |
654 | } | 650 | } |
655 | |||
656 | return (AE_OK); | ||
657 | } | 651 | } |
diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index 80bb65154117..1f58a8824146 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c | |||
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utmutex") | |||
50 | /* Local prototypes */ | 50 | /* Local prototypes */ |
51 | static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); | 51 | static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id); |
52 | 52 | ||
53 | static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); | 53 | static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id); |
54 | 54 | ||
55 | /******************************************************************************* | 55 | /******************************************************************************* |
56 | * | 56 | * |
@@ -114,7 +114,7 @@ void acpi_ut_mutex_terminate(void) | |||
114 | /* Delete each predefined mutex object */ | 114 | /* Delete each predefined mutex object */ |
115 | 115 | ||
116 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { | 116 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
117 | (void)acpi_ut_delete_mutex(i); | 117 | acpi_ut_delete_mutex(i); |
118 | } | 118 | } |
119 | 119 | ||
120 | /* Delete the spinlocks */ | 120 | /* Delete the spinlocks */ |
@@ -146,10 +146,6 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); | 147 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); |
148 | 148 | ||
149 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
150 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
151 | } | ||
152 | |||
153 | if (!acpi_gbl_mutex_info[mutex_id].mutex) { | 149 | if (!acpi_gbl_mutex_info[mutex_id].mutex) { |
154 | status = | 150 | status = |
155 | acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); | 151 | acpi_os_create_mutex(&acpi_gbl_mutex_info[mutex_id].mutex); |
@@ -173,21 +169,15 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
173 | * | 169 | * |
174 | ******************************************************************************/ | 170 | ******************************************************************************/ |
175 | 171 | ||
176 | static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | 172 | static void acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) |
177 | { | 173 | { |
178 | 174 | ||
179 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); | 175 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); |
180 | 176 | ||
181 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
182 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
183 | } | ||
184 | |||
185 | acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); | 177 | acpi_os_delete_mutex(acpi_gbl_mutex_info[mutex_id].mutex); |
186 | 178 | ||
187 | acpi_gbl_mutex_info[mutex_id].mutex = NULL; | 179 | acpi_gbl_mutex_info[mutex_id].mutex = NULL; |
188 | acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 180 | acpi_gbl_mutex_info[mutex_id].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
189 | |||
190 | return_ACPI_STATUS(AE_OK); | ||
191 | } | 181 | } |
192 | 182 | ||
193 | /******************************************************************************* | 183 | /******************************************************************************* |