of: overlay: Correct symbol path fixups
authorPhil Elwell <phil@raspberrypi.com>
Thu, 6 Feb 2020 12:23:15 +0000 (12:23 +0000)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:33:22 +0000 (16:33 +0100)
commit8a438bc363d69ccf06c3f95eb2529da1bd86fe7a
tree080e3de330e5f9505f1d3ab529e45b531bf8447b
parent3cafdde3fc0cf277f4c124d528bb76de1d6860ad
of: overlay: Correct symbol path fixups

When symbols from overlays are added to the live tree their paths must
be rebased. The translated symbol is normally the result of joining
the fragment-relative path (with a leading "/") to the target path
(either copied directly from the "target-path" property or resolved
from the phandle). This translation fails when the target is the root
node (a common case for Raspberry Pi overlays) because the resulting
path starts with a double slash. For example, if target-path is "/" and
the fragment adds a node called "newnode", the label associated with
that node will be assigned the path "//newnode", which can't be found
in the tree.

Fix the failure case by explicitly replacing a target path of "/" with
an empty string.

Fixes: d1651b03c2df ("of: overlay: add overlay symbols to live device tree")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
drivers/of/overlay.c