bcm27xx: update patches from RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0435-of-overlay-Correct-symbol-path-fixups.patch
1 From 8f22c4228bbb91697ab3510f5a6176e530c0d639 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Thu, 6 Feb 2020 12:23:15 +0000
4 Subject: [PATCH] of: overlay: Correct symbol path fixups
5
6 When symbols from overlays are added to the live tree their paths must
7 be rebased. The translated symbol is normally the result of joining
8 the fragment-relative path (with a leading "/") to the target path
9 (either copied directly from the "target-path" property or resolved
10 from the phandle). This translation fails when the target is the root
11 node (a common case for Raspberry Pi overlays) because the resulting
12 path starts with a double slash. For example, if target-path is "/" and
13 the fragment adds a node called "newnode", the label associated with
14 that node will be assigned the path "//newnode", which can't be found
15 in the tree.
16
17 Fix the failure case by explicitly replacing a target path of "/" with
18 an empty string.
19
20 Fixes: d1651b03c2df ("of: overlay: add overlay symbols to live device tree")
21
22 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
23 ---
24 drivers/of/overlay.c | 2 ++
25 1 file changed, 2 insertions(+)
26
27 --- a/drivers/of/overlay.c
28 +++ b/drivers/of/overlay.c
29 @@ -245,6 +245,8 @@ static struct property *dup_and_fixup_sy
30 if (!target_path)
31 return NULL;
32 target_path_len = strlen(target_path);
33 + if (!strcmp(target_path, "/"))
34 + target_path_len = 0;
35
36 new_prop = kzalloc(sizeof(*new_prop), GFP_KERNEL);
37 if (!new_prop)