25 Jan, 2020

1 commit

  • Use realloc and update the loop executed in do_fdtgrep to find all
    the regions: only test count > max_region after the second pass.

    This patch solve an issue if the number of region found (count)
    is greater then the default value (max_region = count = 100):
    the second pass is never executed, because the loop stops after
    the first pass (i = 0, count > 100, max_regions = 100)
    with error -1 and the error message
    "Internal error with fdtgrep_find_region".

    I also update the error message.

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     

19 Jun, 2018

2 commits

  • The current code might succeed on the first allocation and fail on the
    second. Separate the checks to avoid this problem.

    Of course, free() will never fail and the chances that (when allocating
    two small areas) one will succeed and one will fail are just as remote.
    But this keeps coverity happy.

    Reported-by: Coverity (CID: 131226)

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This loop never actually exits, but the way the code is written this is
    not obvious. Add an explicit error check.

    Reported-by: Coverity (CID: 131280)
    Signed-off-by: Simon Glass
    [trini: Add explicit init of region to NULL per LLVM warning]
    Signed-off-by: Tom Rini

    Simon Glass
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

29 Jan, 2018

2 commits

  • Several host-tools use "bool" type without including .
    This relies on the crappy header inclusion chain.

    tools/Makefile has the following line:

    HOST_EXTRACFLAGS += -include $(srctree)/include/libfdt_env.h \

    All host-tools are forced to include libfdt_env.h even if they are
    totally unrelated to FDT. Then, is indirectly included
    as follows:

    include/libfdt_env.h
    -> include/linux/types.h
    ->

    I am fixing this horrible crap. In advance, I need to add necessary
    include directives explicitly. tools/fdtgrep.c needs more;
    for open() and for errno.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Joe Hershberger
    Reviewed-by: Simon Glass

    Masahiro Yamada
     
  • The only difference between scripts/dtc/libfdt/fdt_rw.c and
    lib/libfdt/fdt_rw.c is fdt_remove_unused_strings().

    It is only used by fdtgrep, so we do not need to compile it for U-Boot
    image. Move it to tools/libfdt/fdw_rw.c so that lib/libfdt/fdt_rw.c
    can be a wrapper of scripts/dtc/libfdt/fdt_rw.c.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

06 Nov, 2017

1 commit

  • U-Boot bundles a patched copy of libfdt, so it's wrong to attempt to
    include it . This breaks the build for me when I have dtc
    fully installed in my host -- as happened earlier tonight with
    Buildroot, for example.

    There are several other occurrences throughout the code where ' include style is being used -- IMHO wrongly.

    Signed-off-by: Jan Kundrát

    Jan Kundrát
     

12 Jun, 2017

1 commit


14 Apr, 2017

1 commit


07 Oct, 2016

1 commit


15 Mar, 2016

1 commit


04 Nov, 2015

1 commit


22 Jul, 2015

1 commit

  • This tool allows us to extract subsets of a device tree file. It is used by
    the SPL vuild, which needs to cut down the device tree size for use in
    limited memory.

    This tool was originally written for libfdt but it has not been accepted
    upstream, so for now, include it in U-Boot. Several utilfdt library
    functions been included inline here.

    If fdtgrep is eventually accepted in libfdt then we can bring that version
    of libfdt in here, and drop fdtgrep (requiring that fdtgrep is provided by
    the user).

    If it is not accepted then another approach would be to write a special
    tool for chopping down device tree files for SPL. While it would use the
    same libfdt support, it would be less code than fdtgrep.c because it would
    not have general-purpose functions.

    Another approach (which was used with v1 of this series) is to sprinkler all
    the device tree files with #ifdef. I don't like that idea.

    Signed-off-by: Simon Glass

    Simon Glass