On Mon, 27 Feb 2023 at 12:55, Marek Vasut <marek.vasut+rene...@mailbox.org> wrote: > > Currently any integer array value is set as long up-to-40 character > hexadecimal string into environment variable when extracted from an > FDT using 'fdt get value path prop index', because the support for > handling integer arrays is not implemented, and fdt_value_env_set() > code falls back into the hash handling behavior instead. > > Implement this support simply by checking whether user supplied any > index. If index is set and the property length is multiple of four, > then this is an integer array, and the code would extract value at > specified index. > > There is a subtle change where default index is set to -1 instead of 0. > This is OK, since the only place which checks for index to be less or > equal zero is the string array handling code in fdt_value_env_set() and > that code would work perfectly well with index -1 too. > > Signed-off-by: Marek Vasut <marek.vasut+rene...@mailbox.org> > --- > Cc: Heinrich Schuchardt <heinrich.schucha...@canonical.com> > Cc: Simon Glass <s...@chromium.org> > Cc: Tom Rini <tr...@konsulko.com> > --- > cmd/fdt.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) >
Reviewed-by: Simon Glass <s...@chromium.org>