Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit e0a223b4 authored by Kelley Nielsen's avatar Kelley Nielsen Committed by Greg Kroah-Hartman
Browse files

staging: ft1000: duplicate code replaced with call to request_code_segment



function scram_dnldr, in ft1000_download.c, is very long and consists
mainly of nested switch statements inside a while loop. Some code in one
of the inner switch cases was almost identical to the code in the
previously extracted function request_code_segment. The duplicated code
was replaced with a call to request_code_segment, and
request_code_segment was slightly modified to work in both cases.

A new parameter was added to request_code_segment, a bool to distinguish
which case it was replacing. The name of an existing parameter (now
called endpoint) was changed to reflect the fact that it will be passed
in from more than one place. Several lines from the case containing the
duplicated code were moved to request_code_segment, and a test was added
to determine if these lines or a line from the original function should
be run.

Finally, an unused variable (tempword) was removed from scram_dnldr.

Signed-off-by: default avatarKelley Nielsen <kelleynnn@gmail.com>
Reviewed-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aaeb94c9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment