diff options
author | Rasmus Villemoes | 2022-05-19 11:10:43 +0200 |
---|---|---|
committer | Tom Rini | 2022-06-06 18:01:21 -0400 |
commit | 26f981f295d00351b6f0c69b5317b254b2361cc0 (patch) | |
tree | fb964eaab8c62edc153ceaf47fd11db121d3b960 /lib/fdtdec.c | |
parent | 05947cb1d8d651b6b4e5f5dcbcef8e58d5ec4b44 (diff) |
fdtdec: drop needlessly convoluted CONFIG_PHANDLE_CHECK_SEQ
Asking if the alias we found actually points at the device tree node
we passed in (in the guise of its offset from blob) can be done simply
by asking if the fdt_path_offset() of the alias' path is identical to
offset.
In fact, the current method suffers from the possibility of false
negatives: dtc does not necessarily emit a phandle property for a node
just because it is referenced in /aliases; it only emits a phandle
property for a node if it is referenced in <angle brackets>
somewhere. So if both the node we passed in and the alias node we're
considering don't have phandles, fdt_get_phandle() returns 0 for both.
Since the proper check is so simple, there's no reason to hide that
behind a config option (and if one really wanted that, it should be
called something else because there's no need to involve phandle in
the check).
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Aswath Govindraju <a-govindraju@ti.com>
Diffstat (limited to 'lib/fdtdec.c')
-rw-r--r-- | lib/fdtdec.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/fdtdec.c b/lib/fdtdec.c index e20f6aad9c2..ffa78f97ca0 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -516,11 +516,8 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset, * Adding an extra check to distinguish DT nodes with * same name */ - if (IS_ENABLED(CONFIG_PHANDLE_CHECK_SEQ)) { - if (fdt_get_phandle(blob, offset) != - fdt_get_phandle(blob, fdt_path_offset(blob, prop))) - continue; - } + if (offset != fdt_path_offset(blob, prop)) + continue; val = trailing_strtol(name); if (val != -1) { |