提交 f3badb78 编写于 作者: P Phil Elwell 提交者: Zheng Zengkai

of: overlay: Correct symbol path fixups

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

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: d1651b03 ("of: overlay: add overlay symbols to live device tree")
Signed-off-by: NPhil Elwell <phil@raspberrypi.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 229dd452
...@@ -245,6 +245,8 @@ static struct property *dup_and_fixup_symbol_prop( ...@@ -245,6 +245,8 @@ static struct property *dup_and_fixup_symbol_prop(
if (!target_path) if (!target_path)
return NULL; return NULL;
target_path_len = strlen(target_path); target_path_len = strlen(target_path);
if (!strcmp(target_path, "/"))
target_path_len = 0;
new_prop = kzalloc(sizeof(*new_prop), GFP_KERNEL); new_prop = kzalloc(sizeof(*new_prop), GFP_KERNEL);
if (!new_prop) if (!new_prop)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册