aboutsummaryrefslogtreecommitdiff
path: root/yamltree.c
AgeCommit message (Collapse)AuthorFilesLines
2023-07-28Fix use of <ctype.h> functionsSebastian Huber1-1/+1
The value passed to the <ctype.h> functions shall be the value of an unsigned char or EOF. It is implementation-defined if the char type is signed or unsigned. Cast to unsigned char to avoid undefined behaviour on systems where char is signed. This cast is already present in other parts of the code base. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2023-03-01yamltree.c: fix -Werror=discarded-qualifiers & -Werror=cast-qualMarc-André Lureau1-13/+13
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-06-08yamltree: Remove marker ordering dependencyRob Herring1-7/+9
The check for phandle markers is fragile because the phandle marker must be after a type marker. The only guarantee for markers is they are in offset order. The order at a specific offset is undefined. Rework yaml_propval_int() to get the full marker list, so it can find a phandle marker no matter the ordering. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20210526010335.860787-2-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-10-13dtc: Fix signedness comparisons warnings: change typesAndre Przywara1-3/+3
With -Wsign-compare, compilers warn about a mismatching signedness in comparisons in various parts of dtc. Many variables are using signed types unnecessarily, as we never use negative value in them. Change their types to be unsigned, to prevent issues with comparisons. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Message-Id: <20201012161948.23994-7-andre.przywara@arm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-04-14Fix some potential unaligned accesses in dtcDavid Gibson1-3/+3
Because of the convention of packed representations in property layouts, it's not uncommon to have integer values in properties which aren't naturally aligned. Thus, there are several places in the dtc code where we cast a potentially unaligned byte pointer into an integer pointer and load it directly. On a number of architectures (including sparc64 and arm) this won't work and will cause a fault. In some cases it may be trapped and emulated by the kernel, but not always. Therefore, replace such direct unaligned reads with a helper which will handle unaligned data reads (a variant on the fdtXX_ld() functions already used in libfdt). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-01-29Revert "yamltree: Ensure consistent bracketing of properties with phandles"Rob Herring1-21/+0
This reverts commit 18d7b2f4ee45fec422b7d82bab0b3c762ee907e4. This doesn't work for properties such as 'interrupt-map' that has phandle in the middle of an entry. It would also not work for a 0 or -1 phandle value that acts as a NULL. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20200124144657.29749-1-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-09-25yamltree: Ensure consistent bracketing of properties with phandlesRob Herring1-0/+21
The dts syntax allows for '<>' around phandles and arg cells or not which it didn't matter until adding type information. However, the YAML encoding expects each phandle + args to be bracketed. If TYPE_UINT32 markers are not present before each REF_PHANDLE, fix up the markers and add the TYPE_UINT32 markers. This allows the subsequent YAML emitting code to work as-is. Adding the markers at an earlier stage doesn't work because of possible labels in dts output. We'd have to define the ordering of labels and brackets. Also, it is probably best to have dts output match the input. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20190918183534.24205-1-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-06-21dtc: Replace GPLv2 boilerplate/reference with SPDX tagsRob Herring1-15/+1
Replace instances of GPLv2 or later boilerplate with SPDX tags. Signed-off-by: Rob Herring <robh@kernel.org> Message-Id: <20190620211944.9378-2-robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-09-13Add support for YAML encoded outputGrant Likely1-0/+247
YAML encoded DT is useful for validation of DTs using binding schemas. The YAML encoding is an intermediate format used for validation and is therefore subject to change as needed. The YAML output is dependent on DTS input with type information preserved. Signed-off-by: Grant Likely <grant.likely@arm.com> [robh: make YAML support optional, build fixes, Travis CI test, preserve type information in paths and phandles] Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>