From: Jorge Lopez Date: Mon, 31 Jul 2023 20:31:41 +0000 (-0500) Subject: platform/x86: hp-bioscfg: Remove duplicate use of variable in inner loop X-Git-Tag: v6.6.17~4040^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfecbcb5713c6c602fae3b987478d135c46b4dc5;p=platform%2Fkernel%2Flinux-rpi.git platform/x86: hp-bioscfg: Remove duplicate use of variable in inner loop Replace use of same variable in inner loop. Signed-off-by: Jorge Lopez Link: https://lore.kernel.org/r/20230731203141.30044-9-jorge.lopez2@hp.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede --- 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 3b07391..cffc1c9 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); }