Skip to content

devicetree parsing does not error out on duplicate node namesΒ #49590

@mbolivar-nordic

Description

@mbolivar-nordic

Describe the bug

dtc errors out on duplicate node names:

$ cat foo.dts
/dts-v1/;

/ {
	blub: foo@1234 {
		reg = <1234 4>;
		bar = <1>;
	};

	blab: foo@1234 {
		reg = <1234 4>;
		baz = <2>;
	};
};

$ dtc -Odts foo.dts
foo.dts:8.17-10.4: ERROR (duplicate_node_names): /foo@1234: Duplicate node name
ERROR: Input tree has errors, aborting (use -f to force output)

Zephyr's dtlib doesn't:

$ cat samples/hello_world/app.overlay
/ {
	blub: foo@1234 {
		reg = <1234 4>;
		bar = <1>;
	};

	blab: foo@1234 {
		reg = <1234 4>;
		baz = <2>;
	};
};

$ west build --cmake-only samples/hello_world # no errors

Expected behavior

Our DT parser should be equivalent to dtc and therefore should error out.

Impact

We accept garbage DT files that have duplicate nodes.

Additional context

Originally reported in https://github.com/zephyrproject-rtos/zephyr/pull/48949/files#r955645210

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions