]> asedeno.scripts.mit.edu Git - linux.git/commit
of: overlay: test case of two fragments adding same node
authorFrank Rowand <frank.rowand@sony.com>
Fri, 5 Oct 2018 03:34:33 +0000 (20:34 -0700)
committerFrank Rowand <frank.rowand@sony.com>
Fri, 9 Nov 2018 06:11:51 +0000 (22:11 -0800)
commita68238a19c3b24e43fd2327d102bcea0ccceb7d0
treecd084e69149e0059dd1c8183009478e1e2dd4360
parenta15e824ff2c18b2bb2464227009ae6aac4f07e10
of: overlay: test case of two fragments adding same node

Multiple overlay fragments adding or deleting the same node is not
supported.  An attempt to do so results in an incorrect devicetree.
The node name will be munged for the second add.

After adding this patch, the unittest messages will show:

   Duplicate name in motor-1, renamed to "controller#1"
   OF: overlay: of_overlay_apply() err=0
   ### dt-test ### of_overlay_fdt_apply() expected -22, ret=0, overlay_bad_add_dup_node
   ### dt-test ### FAIL of_unittest_overlay_high_level():2419 Adding overlay 'overlay_bad_add_dup_node' failed

   ...

   ### dt-test ### end of unittest - 210 passed, 1 failed

The incorrect (munged) node name "controller#1" can be seen in the
/proc filesystem:

   $ pwd
   /proc/device-tree/testcase-data-2/substation@100/motor-1
   $ ls
   compatible    controller    controller#1  name          phandle       spin
   $ ls controller
   power_bus
   $ ls controller#1
   power_bus_emergency

Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
drivers/of/unittest-data/Makefile
drivers/of/unittest-data/overlay_bad_add_dup_node.dts [new file with mode: 0644]
drivers/of/unittest.c