[PATCH V3 2/2] fw_env: simplify logic & code paths in the fw_env_open()
Tom Rini
trini at konsulko.com
Fri Feb 11 18:06:01 CET 2022
On Wed, Jan 12, 2022 at 12:47:06PM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at milecki.pl>
>
> Environment variables can be stored in two formats:
> 1. Single entry with header containing CRC32
> 2. Two entries with extra flags field in each entry header
>
> For that reason fw_env_open() has two main code paths and there are
> pointers for CRC32/flags/data.
>
> Previous implementation was a bit hard to follow:
> 1. It was checking for used format twice (in reversed order each time)
> 2. It was setting "environment" global struct fields to some temporary
> values that required extra comments explaining it
>
> This change simplifies that code:
> 1. It introduces two clear code paths
> 2. It sets "environment" global struct fields values only once it really
> knows them
>
> To be fair there are *two* crc32() calls now and an extra pointer
> variable but that should be cheap enough and worth it.
>
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220211/409d264f/attachment.sig>
More information about the U-Boot
mailing list