| From 502ec093a22609685ba892a8e1e76319f2d97940 Mon Sep 17 00:00:00 2001 |
| From: Frank Rowand <frank.rowand@sony.com> |
| Date: Tue, 17 Oct 2017 16:36:28 -0700 |
| Subject: [PATCH 0912/1795] of: overlay: loosen overly strict phandle clash |
| check |
| |
| When an overlay contains a node that already exists in |
| the live device tree, the overlay node is not allowed |
| to change the phandle of the existing node. |
| |
| The existing check refused to allow an overlay node to |
| set the node phandle even when the existing node did |
| not have a phandle. Relax the check to allow an |
| overlay node to set the phandle value if the existing |
| node does not have a phandle. |
| |
| Signed-off-by: Frank Rowand <frank.rowand@sony.com> |
| Signed-off-by: Rob Herring <robh@kernel.org> |
| (cherry picked from commit 6d0f5470dbdeb7f9b1e20fc9409bf07fab1b5ac5) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| --- |
| drivers/of/overlay.c | 8 ++++---- |
| 1 file changed, 4 insertions(+), 4 deletions(-) |
| |
| diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c |
| index 4cdee169a5ab..791753321ed2 100644 |
| --- a/drivers/of/overlay.c |
| +++ b/drivers/of/overlay.c |
| @@ -311,10 +311,10 @@ static int add_changeset_node(struct overlay_changeset *ovcs, |
| return build_changeset_next_level(ovcs, tchild, node, 0); |
| } |
| |
| - if (node->phandle) |
| - return -EINVAL; |
| - |
| - ret = build_changeset_next_level(ovcs, tchild, node, 0); |
| + if (node->phandle && tchild->phandle) |
| + ret = -EINVAL; |
| + else |
| + ret = build_changeset_next_level(ovcs, tchild, node, 0); |
| of_node_put(tchild); |
| |
| return ret; |
| -- |
| 2.19.0 |
| |