]> git.baikalelectronics.ru Git - uboot.git/commit
arm64: zynqmp: Fix set_fdtfile() not to break u-boots DTB
authorIgor Lantsman <igor.lantsman@opsys-tech.com>
Wed, 24 Jun 2020 12:33:46 +0000 (14:33 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 20 Aug 2020 07:49:20 +0000 (09:49 +0200)
commit0d4285c0ececc3cb98f8c927f26ae80dd80e6cfd
tree7572a0c75e39b90a9981100048041060d8e8781a
parent7a0ec7993c98fbf7770163526f8d8136544b300d
arm64: zynqmp: Fix set_fdtfile() not to break u-boots DTB

Origin function was calling strsep which replaced delimiter ',' by a null
byte ('\0'). Operation was done directly on FDT which ends up with the
following behavior:

ZynqMP>  printenv fdtfile
fdtfile=xilinx/zynqmp.dtb
ZynqMP> fdt addr $fdtcontroladdr
ZynqMP> fdt print / compatible
compatible = "xlnx", "zynqmp"

As is visible fdtfile was correctly composed but a null byte caused that
xlnx was separated from zynqmp.
This hasn't been spotted because in all Xilinx DTs there are at least 3
compatible string and only the first one was affected by this issue.
But for systems which only had one compatible string "xlnx,zynqmp" it was
causing an issue when U-Boot's DT was used by Linux kernel.

The patch removes strsep calling and strchr is called instead which just
locate the first char after deliminator ',' (variable called "name").
And using this pointer in fdtfile composing.

Fixes: 62984e6a30d4 ("arm64: zynqmp: Create fdtfile from compatible string")
Reported-by: Igor Lantsman <igor.lantsman@opsys-tech.com>
Signed-off-by: Igor Lantsman <igor.lantsman@opsys-tech.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynqmp/zynqmp.c