Introduce prepare-release for the deterministic parts of preparing a
release. Update AGENTS.md to use that, rather than using an LLM for
deterministic steps.
finalize-release now pushes the release commit and tag after signing, and
prepares a release announcement mail.
Assisted-by: Claude:claude-opus-4-6i
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Commit bdca8612 introduced the new fdt_setprop_namelen() and
fdt_setprop_placeholder_namelen() functions, making the existing
fdt_setprop() and fdt_setprop_placeholder() trivial inline wrappers around
them. I failed to realise that replacing the existing functions with
(static) inlines breaks the library ABI.
Theoretically it's possible to have the functions available as both an
inline and a "real" symbol. However, because they do need to call strlen()
before the lower level fdt function, these wrappers aren't quite as
trivial as they appear (inlining may not be zero cost). So, instead revert
and keep the old functions as true functions.
Reported-by: David Runge <dave@sleepmap.de>
Fixes: bdca8612 ("libfdt: Add fdt_setprop_namelen()")
Link: https://github.com/dgibson/dtc/issues/184
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The codebase already has macOS support (dylib flags in the Makefile,
macOS linker handling in meson.build), but CI only tests Linux,
Windows, and FreeBSD. This means macOS regressions go unnoticed
until a user reports them.
Add a build-macos job that tests both Make and Meson builds on
macos-latest. The runner ships with clang, flex, bison, python3,
and git; only libyaml, swig, meson, ninja, and pkg-config are
installed via Homebrew.
Apple Clang uses -Wsign-compare by default, which trips on some lex
generated code. Suppress the warning for the two flex-generated
objects.
We skip tests for now, because trees.S doesn't work with the MacOS
assembler.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
MSYS2 has dropped the mingw-w64-i686-swig package, causing the mingw32
CI job to fail during setup. Since the Windows build doesn't enable
Python bindings anyway, conditionally install swig and
python-setuptools-scm only for the 64-bit subsystems.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Claude Code auto-loads CLAUDE.md at session start but does not look
for AGENTS.md. Without this file, a fresh session misses the
project's AI contribution policy (attribution format, DCO rules,
build instructions) unless the user explicitly points it there.
Include a note pinning the Assisted-by agent name to "Claude" for
consistency — previous sessions have used varying formats
(claude-code, Claude Code, Claude).
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Document the release workflow in AGENTS.md, splitting it into
agent-preparable draft steps and human-only finalization. Add
scripts/finalize-release which amends the version bump commit with
Signed-off-by, creates a signed tag, and optionally invokes kup-dtc
for upload. Remove the now-redundant dist and kup targets from the
Makefile.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Add AI coding assistant policy to CONTRIBUTING.md, modelled on the
Linux kernel's coding-assistants.rst. Covers DCO/Signed-off-by
restrictions, licensing requirements, and the Assisted-by attribution
format.
Add AGENTS.md with codebase guidance for AI coding assistants.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
fdt_property() unconditionally calls memcpy(ptr, val, len) even when
len is zero and val is NULL. This is a legitimate calling convention
for adding empty FDT properties such as "interrupt-controller", which
carry no payload.
However, compilers that treat memcpy as nonnull on its pointer arguments
will fire UBSAN before observing that len is zero.
Guard the memcpy() with a check on len so it is skipped entirely when
there is no payload to copy, bringing the code in line with the
nonnull contract.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The WARNING macro signature is (name, fn, data, ...prereqs), but
interrupts_property was registered with &phandle_references in the data
slot instead of as a prereq. Since c->data is const void *, the misuse
compiled silently and the check has been running with num_prereqs == 0.
The bug is normally masked: many other checks (interrupt_map,
gpios_property, omit_unused_nodes, and the *_property checks generated
by WARNING_PROPERTY_PHANDLE_CELLS) correctly list phandle_references as
a prereq, and run_check recurses into prereqs unconditionally. As long
as any one of them is enabled, fixup_phandle_references is pulled in
transitively and the parser's 0xffffffff placeholder is replaced with
the real phandle before check_interrupts_property reads it.
The bug becomes visible when every other consumer of phandle_references
is silenced (-Eno-phandle_references plus -Wno- for the *_property,
gpios_property and interrupt_map checks). In that case the placeholder
remains and interrupts_property falsely reports "Invalid phandle" /
"Missing interrupt-parent" on a valid tree. Reordering check_table[]
could also expose it under default flags.
Add the missing NULL so &phandle_references lands in the prereq slot.
Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
fdt_num_mem_rsv() can return an error if the memory reservation block
is not properly terminated with a (0, 0) entry. However several other
places in libfdt called it without checking for error returns, and could
therefore return strange results, or in the case of fdt_open_into()
crash.
Fix this by always checking the return value. Add some addition tests to
catch this bug.
Reported-by: Moshe Strauss <moshestrauss10@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
libfdt.h is divided in when it uses "Return:" and when it uses "returns:"
to describe the return value in function documentation comments.
Standardise on "returns:" since it is more prevalent (74 vs 19
occurrences).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
A recent strengthening of -Wunused-but-set-variable (enabled with -Wall)
in clang under a new subwarning, -Wunused-but-set-global, points out an
unused static global variable in dtc-lexer.l:
../dtc-lexer.l:42:12: error: variable 'dts_version' set but not used [-Werror,-Wunused-but-set-global]
42 | static int dts_version = 1;
| ^
This variable has been unused since commit 4e1a0a0 ("Remove support for
the legacy DTS source file format."). Remove it to clear up the warning.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Message-ID: <20260325-dtc-lexer-remove-dts_version-v1-1-0b5d64903bbb@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
fdt_check_full() makes the assumption that a FDT_END tag is present
immediately after the FDT_END_NODE tag related to the root node.
This assumption is not correct. Indeed, FDT_NOP tags can be present
between this FDT_END_NODE tag and the FDT_END tag.
Handle those possible FDT_NOP tags.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Message-ID: <20260210173349.636766-8-herve.codina@bootlin.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Current code perform a version downgrade at one place only, the end of
fdt_rw_probe_().
In order to offer a finer grain and choose to downgrade or not depending
on the exact writes done, introduce fdt_downgrade_version() to perform
the downgrade operation.
The modification doesn't introduce any functional changes.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Message-ID: <20260210173349.636766-5-herve.codina@bootlin.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
fdtdump prints a message on stderr when it encounters a wrong tag and
stop its processing without returning an error code.
Having a wrong tag is really a failure. Indeed, the processing cannot
continue.
Be more strict. Stop the processing, print a message and return an
error code. In other words, call die().
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Message-ID: <20260210173349.636766-4-herve.codina@bootlin.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
fdtdump checks the dtb version and simply failed if the dtb version is
newer than the last version supported by fdtdump.
This check is not needed and too restrictive. Indeed, fdtdump does
read-only operations on the dtb provided and should rely only the
last_comp_version header field to know whether or not it can read the
dtb.
The current check also avoid the use of fdtdump in tests checking for
the libfdt behavior when an new (future) dtb version is used.
Relax fdtdump checks removing the check of the dtb version header field.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Message-ID: <20260210173349.636766-3-herve.codina@bootlin.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The basenamelen member in the node structure is set in all cases to
a positive value, the length of the basename string. Also it is used as
parameters on function expecting a size_t type.
Further more an implicit cast of strspn() returned value from size_t to
int is needed in checks.c to avoid a signed/unsigned compilation warning
when this value is checked.
This member has no reason to be a signed integer and its obvious type is
size_t.
Be consistent and fix its type.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Message-ID: <20260210173349.636766-2-herve.codina@bootlin.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
A dtb is considered malformed if its structural elements (not things within
property values) are not naturally aligned. This means that the structure
block must be aligned to a 32-bit boundary, the reserve map must be aligned
to 64-bit boundary and the whole thing must be loaded at a 64-bit aligned
address. We currently verify that lasat condition in fdt_check_header()
but not the other cases.
Reported-by: Owen Sanzas (Ze Sheng) 盛泽 <zesheng@tamu.edu>
Link: https://github.com/dgibson/dtc/issues/178
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The __fixups__ node contains information about labels. Parse its
properties to create phandle markers which improve the resulting dts
when decompiling a device tree blob.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20250919092912.663304-14-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The __local_fixups__ node contains information about phandles. Parse it
to improve the result when decompiling a device tree blob.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20250919092912.663304-13-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
If the input has a __symbols__ node, restore the named labels for the
respective nodes.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20250919092912.663304-12-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
In the presence of (non-type) markers guess the type of each chunk
between markers individually instead of only once for the whole
property.
Note that this only gets relevant with the next few commits that restore
labels and phandles. Note further that this rework is necessary with
these further changes, because phandle markers are currently not
considered for type guessing and so a phandle at an offset that isn't a
multiple of 4 triggers an assertion if the property was guessed to have
type TYPE_UINT32.
Now that guess_value_type() is only called for data chunks without
markers, the function can be simplified a bit.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20250919092912.663304-11-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The need for the plugin flag is determined by the existence of __fixups__
or __local_fixups__.
This is a bit simplifying because if __fixups__ or __local_fixups__
exist but don't have properties, the plugin flag isn't needed. But in
practise the test should be good enough such that this corner case
doesn't matter.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20250919092912.663304-10-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This fixes `dtc -I dts -O dts` to make the file a plugin if the source
file is one.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20250919092912.663304-9-u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The Devicetree specification states that a node name shall be of form
`node-name@unit-address` and that the `node-name` component cannot be
empty.
However, the `dtc` parser considers a node name as a non-empty
sequences of the allowed characters plus the @ character, and
unit-address extraction is processed after parsing.
This has the side effect of considering an empty name plus an address
as a valid node name (e.g. `@0`). I've added the node_name_not_empty
check, verifying that the `node->basenamelen` is not zero (unless it's
the root node).
Signed-off-by: Mattia Maldini <mattia512maldini@gmail.com>
[dwg: Re-wrap commit message]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
In order to ease future tags addition, perform operation related to
FDT_PROP when the tag is explicitly FDT_PROP instead of relying to a
kind of default value case.
Handle the FDT_PROP tag exactly in the same way as it is done for
other tags.
No functional modification.
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Message-ID: <20260112142009.1006236-6-herve.codina@bootlin.com>
Reviewed-by: Ayush Singh <ayush@beagleboard.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
It's unsafe to implicitly discard the const qualifier on a pointer. In
overlay_fixup_phandle(), this was probably just an oversight, and making
the "sep" variable a const char * is sufficient to fix it.
In create_node(), however, the "p" variable is directly modifying the
buffer pointed to by "const char* node_name". To fix this, we need to
actually make a duplicate of the buffer and operate on that instead.
This introduces a malloc()/free() and an unbounded strdup() into the
operation, but fdtput isn't a long-running service and the node_name
argument comes directly from argv, so this shouldn't introduce a
significant performance impact.
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
In this function from fdt_ro.c we have (reasonably) some checks of the
DTB before we begin work. However, we do this in a way that we cannot
make use of the normal FDT_RO_PROBE macro and instead have a direct call
to fdt_ro_probe_(). Add a test for !can_assume(VALID_DTB) here first so
that in cases where we are assuming a valid DTB we can omit the checks.
Signed-off-by: Tom Rini <trini@konsulko.com>
Message-ID: <20251210022002.3004223-4-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
In the case where we have set FDT_ASSUME_MASK to disable
ASSUME_VALID_DTB checks, we can improve the FDT_RO_PROBE macro slightly.
The first thing that fdt_ro_probe_() does when we can_assume(VALID_DTB)
is true is to return whatever the contents of the totalsize field of the
DTB is. Since the FDT_RO_PROBE macro only cares about a negative value
there, we can optimize this check such that we are to assume it's a
valid DTB, we don't need to do anything here.
Signed-off-by: Tom Rini <trini@konsulko.com>
Message-ID: <20251210022002.3004223-3-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The value "ASSUME_SANE" was never used in the project here, only
ASSUME_PERFECT was used. Update the comment to reflect the correct name.
Fixes: 464962489d ("Add a way to control the level of checks in the code")
Signed-off-by: Tom Rini <trini@konsulko.com>
Message-ID: <20251210022002.3004223-2-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The check for the MacOS X version (10.7) is problematic, because it
fails unless _DARWIN_C_SOURCE is defined if also _POSIX_C_SOURCE or
_XOPEN_SOURCE is defined, as then the Darwin version defines are not
defined. We cannot force _DARWIN_C_SOURCE reliably in the header
either, because we cannot be sure that the libfdt_env.h has not already
been included by another source before.
The check is also only for very old versions of Mac OS X. In the
interest of not replacing strnlen arbitrarily for sources using
libfdt and considering that the last version of OS X 10.6 was
released in 2011 I propose to remove the workaround for that system.
We noticed as compiling fdt_strnlen in C++ environments fails
(missing cast for memchr).
Signed-off-by: Adam Lackorzynski <adam@l4re.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The path given as an alias inside an overlay can be a path to a node
in the base DT. The path check searches only the overlay as that is
the only tree available leading to false check failures.
Skip this check when checking an overlay.
Signed-off-by: Andrew Davis <afd@ti.com>
Message-ID: <20250822171038.190122-1-afd@ti.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Removing the complete __fixups__ and __local_fixups__ tree might delete
data that should better be retained. See the added test for a situation
that was broken before.
Note that without removing /__fixups__ and /__local_fixups__ in
generate_fixups_tree() and generate_local_fixups_tree() respectively
calling build_and_name_child_node() isn't safe as the nodes might
already exist and then a duplicate would be added. So build_root_node()
has to be used which copes correctly here.
Fixes: 915daadbb6 ("Start with empty __local_fixups__ and __fixups__ nodes")
Closes: https://github.com/dgibson/dtc/issues/170
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <b061ee57157fafbb9d5b9b0b86af760d13a04eda.1755512759.git.u.kleine-koenig@baylibre.com>
[dwg: Use -1 instead of 1 as an error return]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The dtc graph_child_address check can't distinguish between bindings
where there can only be a single endpoint, and cases where there can be
multiple endpoints.
In cases where the bindings allow for multiple endpoints but only one is
described false warnings about unnecessary #address-cells/#size-cells
can be generated, but only if the endpoint described have an address of
0 (A), for single endpoints with a non-zero address (B) no warnings are
generated.
A)
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
#address-cells = <1>;
#size-cells = <0>;
sourceA: endpoint@0 {
reg = <0>
};
};
};
B)
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
#address-cells = <1>;
#size-cells = <0>;
sourceB: endpoint@1 {
reg = <1>
};
};
};
Remove the check as it is somewhat redundant now that we can use schemas
to validate the full node.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <20250817133733.3483922-1-niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The two if branches are quite similar. Build the property first (in case
it doesn't exist) and then the common parts can be done outside the if
block.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <eef88e559f5b9818c4c2311fa8a75ab6fd4508d5.1755512759.git.u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Commit 0f69cedc08 ("libfdt_internal: fdt_find_string_len_()") added a
string.h include to libfdt_internal.h which introduces a libc dependency
which cannot be overridden. Environments without libc (e.g. Linux
kernel) use a custom libfdt_env.h. string.h is already indirectly
included in libfdt_env.h, so it can be dropped from libfdt_internal.h.
Fixes: 0f69cedc08 ("libfdt_internal: fdt_find_string_len_()")
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Message-ID: <20250811130416.2653959-1-robh@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This still requires you to specify paths with forward slashes instead of
backslashes on Windows, due to many hardcoded checks for '/'.
Fortunately, the Windows user APIs all support forward slashes too.
Signed-off-by: Colin Finck <mail@colinfinck.de>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Add FreeBSD test coverage with builds on FreeBSD 13.5 and 14.3 using
both make and meson build systems.
Generated-by: Claude Code 1.0.65 (claude-sonnet-4@20250514)
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Add GitLab CI with Linux builds on Alpine, Arch, Fedora, and Ubuntu using
both make and meson build systems.
Generated-by: Claude Code 1.0.65 (claude-sonnet-4@20250514)
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Remove some unnecessary package dependencies. Also include testing of the
'ci' branch (so as to test in-progress changes to the CI configuration
itself).
Generated-by: Claude Code 1.0.65 (claude-sonnet-4@20250514)
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Add compatibility fixes for non-GNU compilers and linkers by testing
versions before using certain flags. In particular this fixes make build
problems on FreeBSD.
Generated-by: Claude Code 1.0.65 (claude-sonnet-4@20250514)
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Largely an experiment using an AI assistant. Used Claude to generate
documentation comments for most of the functions in libfdt.h which
currently lack them. Then hand reviewed and edited.
Or, as Claude describes it:
Add detailed documentation comments for core libfdt functions including:
- Low-level functions (fdt_offset_ptr, fdt_next_tag, fdt_check_full)
- Sequential write functions (fdt_resize, fdt_add_reservemap_entry,
fdt_finish_reservemap, fdt_begin_node, fdt_property, fdt_end_node, fdt_finish)
- Read-write functions (fdt_create_empty_tree, fdt_open_into, fdt_pack)
- Error handling (fdt_strerror)
Documentation includes parameter descriptions, return value meanings,
and usage notes for proper API usage.
Generated-by: Claude 1.0.64 (claude-sonnet-4@20250514)
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
In some places run_tsets.sh needs to get the size of files, which it does
with stat(1). However the syntax to do this is different between GNU
coreutils stat(1) and BSD's stat(1). We have some logic that looks for
"GNU" in the version string to figure out the correct version.
This will break upcoming Ubuntu versions which are now using uutils, a Rust
reimplementation of coreutils. These support the same GNU syntax, but
don't have the "GNU" in the version string.
Update the detection to simply try the GNU version and otherwise assume
BSD.
Link: https://github.com/dgibson/dtc/issues/166
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
I find the exact semantics of scanf() always confusing, and mostly we use
strtol() and similar functions instead. Switch fdtput to using strtol and
similar functions instead of sscanf().
As well as being more in keeping with what we do in other places, this
works around a FreeBSD bug[0], where sscanf(), but not strtol() parses
"003" as having value 0.
[0] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288440
Link: https://github.com/dgibson/dtc/issues/165
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Some of our testcases check fdtget retreiving string list properties that
include internal \0 characters. We use printf(1) to generate the expected
value for comparison.
However, on FreeBSD, printf(1)'s %b format option can't handle \0: it will
terminate that argument ignoring it and everything after. Curiously,
internal \0 *is* ok in the main format string. So avoid using %b and use
the format string directly instead.
Link: https:/https://github.com/dgibson/dtc/issues/165
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
When a DTS is preprocessed, sometimes the user fails to include the
correct header files, or make a spelling mistake on a macro name. This
leads to a stray identifier in the DTS, like:
property = <1 2 FOO BAR(3, 4)>;
Give a more helpful error message than "syntax error" by recognizing and
reporting the identifier, like this:
Lexical error: <stdin>:2.21-24 Unexpected 'FOO'
Also, treat that identifier as literal, which often helps the parser go
further and may generate more helpful error messages.
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
If an I2C controller has a 'i2c-bus' child node, then the function
check_i2c_bus_bridge() does not detect this as expected and warnings
such as the following are observed:
Warning (i2c_bus_bridge): /example-0/i2c@7000c000: \
incorrect #address-cells for I2C bus
Warning (i2c_bus_bridge): /example-0/i2c@7000c000: \
incorrect #size-cells for I2C bus
These warnings occur because the '#address-cells' and '#size-cells' are
not directly present under the I2C controller node but the 'i2c-bus'
child node. The function check_i2c_bus_bridge() does not detect this
because it is using the parent node's 'basenamelen' and not the child
node's 'basenamelen' when comparing the child node name with 'i2c-bus'.
The parent node's 'basenamelen' is shorter ('i2c') than 'i2c-bus' and so
the strprefixeq() test fails. Fix this by using the child node
'basenamelen' when comparing the child node name.
Fixes: 53a1bd5469 ("checks: add I2C bus checks")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Message-ID: <20250709142452.249492-1-jonathanh@nvidia.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
The add_marker() function is used to create a new marker and add it at
the right spot to the relevant marker list. Use it in the
add_string_markers() helper (which gets slightly quicker by it).
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>