2023-07-31 21:35:08

by Jorge Lopez

[permalink] [raw]
Subject: [PATCH 8/8] hp-bioscfg: Remove duplicate use of variable in inner loop

Replace use of same variable in inner loop.

Signed-off-by: Jorge Lopez <[email protected]>

---
Based on the latest platform-drivers-x86.git/for-next
---
.../x86/hp/hp-bioscfg/order-list-attributes.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
index 3b073910b430..cffc1c9ba3e7 100644
--- a/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
+++ b/drivers/platform/x86/hp/hp-bioscfg/order-list-attributes.c
@@ -136,6 +136,7 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
u32 size;
u32 int_value = 0;
int elem;
+ int olist_elem;
int reqs;
int eloc;
char *tmpstr = NULL;
@@ -147,10 +148,7 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
if (!order_obj)
return -EINVAL;

- for (elem = 1, eloc = 1; elem < order_obj_count; elem++, eloc++) {
- /* ONLY look at the first ORDERED_ELEM_CNT elements */
- if (eloc == ORD_ELEM_CNT)
- goto exit_list;
+ for (elem = 1, eloc = 1; eloc < ORD_ELEM_CNT; elem++, eloc++) {

switch (order_obj[elem].type) {
case ACPI_TYPE_STRING:
@@ -277,10 +275,10 @@ static int hp_populate_ordered_list_elements_from_package(union acpi_object *ord
tmpstr,
sizeof(ordered_list_data->elements[0]));

- for (elem = 1; elem < MAX_ELEMENTS_SIZE && part; elem++) {
- strscpy(ordered_list_data->elements[elem],
+ for (olist_elem = 1; olist_elem < MAX_ELEMENTS_SIZE && part; olist_elem++) {
+ strscpy(ordered_list_data->elements[olist_elem],
part,
- sizeof(ordered_list_data->elements[elem]));
+ sizeof(ordered_list_data->elements[olist_elem]));
part = strsep(&part_tmp, SEMICOLON_SEP);
}

--
2.34.1