[PATCH v2] dm: Fix OF_BAD_ADDR definition

Simon Glass sjg at chromium.org
Fri Jan 21 16:20:37 CET 2022


On Tue, 4 Jan 2022 at 00:42, Patrice Chotard
<patrice.chotard at foss.st.com> wrote:
>
> When OF_LIVE flag is enabled on a 64 bits platform, there is an
> issue when dev_read_addr() is called and need to perform an address
> translation using __of_translate_address().
>
> In case of error, __of_translate_address() return's value is OF_BAD_ADDR
> (wich is defined in include/dm/of.h to ((u64)-1) = 0xffffffffffffffff).
> The return value of dev_read_addr() is often compared to FDT_ADDR_T_NONE
> which is defined as (-1U) = 0xffffffff.
> In this case the comparison is always false.
>
> To fix this issue, define FDT_ADDR_T_NONE to (ulong)(-1) in case of
> AARCH64. Update accordingly related tests.
>
> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
>
> ---
>
> Changes in v2:
>  - define FDT_ADDR_T_NONE as ((ulong)(-1)) and keep OF_BAD_ADDR unchanged
>
>  include/fdtdec.h   | 5 ++++-
>  test/dm/ofnode.c   | 2 +-
>  test/dm/pci.c      | 4 ++--
>  test/dm/test-fdt.c | 2 +-
>  4 files changed, 8 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list