Re: [PATCH] Make duplicate node name checks fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Nov 29, 2018 at 05:00:52PM -0600, Rob Herring wrote:
> I stumbled on a problem when removing an include that I started getting
> an unrelated error about duplicate errors. The change here is the
> minimal change that makes a failing dts compile "successfully".
> 
> Posting this as I'm not familiar with the parsing code.
> 
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>

This is a kinda ugly side effect of the way (compile time) overlay
processing is done.  After we parse and construct the second / { }
block, we merge it into the existing tree.

merge_nodes() steps through each subnode in the second fragment
merging it into a matching node in the base tree, or adding if it if
wasn't present already.

But, it just does this in order, so when it sees the first '/node' in
the second fragment it adds it to the base tree, then when it sees the
second '/node' it merges that into the one it already added.

So, by the time we get to the checks stage there isn't a duplicate
node name any more.

> ---
>  tests/dup-nodename.dts | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/dup-nodename.dts b/tests/dup-nodename.dts
> index 2a3aa7596b9c..ac6ec8013afb 100644
> --- a/tests/dup-nodename.dts
> +++ b/tests/dup-nodename.dts
> @@ -1,5 +1,7 @@
>  /dts-v1/;
>  
> +/{};
> +
>  / {
>  	node {
>  	};

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux