[PATCH 1/1] powerpc/boot: remove unused function find_node_by_linuxphandle()

2022-04-24 Thread frowand . list
From: Frank Rowand The last user of find_node_by_linuxphandle() was removed in v4.18-rc1 by commit 30f4bbe0472a ("powerpc/boot: Remove support for Marvell MPSC serial controller") four years ago. This function is no longer needed. Signed-off-by: Frank Rowand --- arch/powerpc/boot/ops.h | 6

[PATCH v3 0/2] of: phandle_cache, fix refcounts, remove stale entry

2018-12-18 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. This bug exposed the foloowing phandle cache refcount bug. The refcount of phandle_cache entries is not

[PATCH v3 1/2] of: of_node_get()/of_node_put() nodes held in phandle cache

2018-12-18 Thread frowand . list
From: Frank Rowand The phandle cache contains struct device_node pointers. The refcount of the pointers was not incremented while in the cache, allowing use after free error after kfree() of the node. Add the proper increment and decrement of the use count. Fixes: 0b3ce78e90fc ("of: cache

[PATCH v3 2/2] of: __of_detach_node() - remove node from phandle cache

2018-12-18 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. Remove the node from the cache. Add paranoia checks in of_find_node_by_phandle() as a second level of

[PATCH v2 2/2] of: __of_detach_node() - remove node from phandle cache

2018-12-17 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. Remove the node from the cache. Add paranoia checks in of_find_node_by_phandle() as a second level of

[PATCH v2 1/2] of: of_node_get()/of_node_put() nodes held in phandle cache

2018-12-16 Thread frowand . list
From: Frank Rowand The phandle cache contains struct device_node pointers. The refcount of the pointers was not incremented while in the cache, allowing use after free error after kfree() of the node. Add the proper increment and decrement of the use count. Fixes: 0b3ce78e90fc ("of: cache

[PATCH v2 0/2] of: phandle_cache, fix refcounts, remove stale entry

2018-12-16 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. This bug exposed the foloowing phandle cache refcount bug. The refcount of phandle_cache entries is not

[PATCH 2/2] of: __of_detach_node() - remove node from phandle cache

2018-12-13 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. Remove the node from the cache. Add paranoia checks in of_find_node_by_phandle() as a second level of

[PATCH 1/2] of: of_node_get()/of_node_put() nodes held in phandle cache

2018-12-13 Thread frowand . list
From: Frank Rowand The phandle cache contains struct device_node pointers. The refcount of the pointers was not incremented while in the cache, allowing use after free error after kfree() of the node. Add the proper increment and decrement of the use count. Fixes: 0b3ce78e90fc ("of: cache

[PATCH 0/2] of: phandle_cache, fix refcounts, remove stale entry

2018-12-13 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. This bug exposed the foloowing phandle cache refcount bug. The refcount of phandle_cache entries is not

[PATCH] of: add dtc annotations functionality to dtx_diff

2018-11-26 Thread frowand . list
From: Frank Rowand Add -T and --annotations command line arguments to dtx_diff. These arguments will be passed through to dtc. dtc will then add source location annotations to its output. Signed-off-by: Frank Rowand --- This feature depends upon commit 5667e7ef9a9a ("annotations: add the

[PATCH v7 17/17] of: unittest: initialize args before calling of_*parse_*()

2018-11-08 Thread frowand . list
From: Frank Rowand Callers of of_irq_parse_one() blindly use the pointer args.np without checking whether of_irq_parse_one() had an error and thus did not set the value of args.np. Initialize args to zero so that using the format "%pOF" to show the value of args.np will show "(null)" when

[PATCH v7 16/17] of: unittest: find overlays[] entry by name instead of index

2018-11-08 Thread frowand . list
From: Frank Rowand One accessor of overlays[] was using a hard coded index value to find the correct array entry instead of searching for the entry containing the correct name. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 21 + 1 file

[PATCH v7 15/17] of: unittest: allow base devicetree to have symbol metadata

2018-11-08 Thread frowand . list
From: Frank Rowand The overlay metadata nodes in the FDT created from testcases.dts are not handled properly. The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be. Only the first property in the /__symbols__ node was added to the live devicetree if the

[PATCH v7 14/17] of: overlay: set node fields from properties when add new overlay node

2018-11-08 Thread frowand . list
From: Frank Rowand Overlay nodes added by add_changeset_node() do not have the node fields name, phandle, and type set. The node passed to __of_attach_node() when the add node changeset entry is processed does not contain any properties. The node's properties are located in add property

[PATCH v7 13/17] of: unittest: remove unused of_unittest_apply_overlay() argument

2018-11-08 Thread frowand . list
From: Frank Rowand Argument unittest_nr is not used in of_unittest_apply_overlay(), remove it. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c

[PATCH v7 12/17] of: overlay: check prevents multiple fragments touching same property

2018-11-08 Thread frowand . list
From: Frank Rowand Add test case of two fragments updating the same property. After adding the test case, the system hangs at end of boot, after after slub stack dumps from kfree() in crypto modprobe code. Multiple overlay fragments adding, modifying, or deleting the same property is not

[PATCH v7 11/17] of: overlay: check prevents multiple fragments add or delete same node

2018-11-08 Thread frowand . list
From: Frank Rowand Multiple overlay fragments adding or deleting the same node is not supported. Replace code comment of such, with check to detect the attempt and fail the overlay apply. Devicetree unittest where multiple fragments added the same node was added in the previous patch in the

[PATCH v7 10/17] of: overlay: test case of two fragments adding same node

2018-11-08 Thread frowand . list
From: Frank Rowand 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,

[PATCH v7 09/17] of: overlay: make all pr_debug() and pr_err() messages unique

2018-11-08 Thread frowand . list
From: Frank Rowand Make overlay.c debug and error messages unique so that they can be unambiguously found by grep. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/overlay.c

[PATCH v7 08/17] of: overlay: validate overlay properties #address-cells and #size-cells

2018-11-08 Thread frowand . list
From: Frank Rowand If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry

[PATCH v7 07/17] of: overlay: reorder fields in struct fragment

2018-11-08 Thread frowand . list
From: Frank Rowand Order the fields of struct fragment in the same order as struct of_overlay_notify_data. The order in struct fragment is not significant. If both structs are ordered the same then when examining the data in a debugger or dump the human involved does not have to remember which

[PATCH v7 06/17] of: overlay: do not duplicate properties from overlay for new nodes

2018-11-08 Thread frowand . list
From: Frank Rowand When allocating a new node, add_changeset_node() was duplicating the properties from the respective node in the overlay instead of allocating a node with no properties. When this patch is applied the errors reported by the devictree unittest from patch "of: overlay: add tests

[PATCH v7 05/17] of: overlay: use prop add changeset entry for property in new nodes

2018-11-08 Thread frowand . list
From: Frank Rowand The changeset entry 'update property' was used for new properties in an overlay instead of 'add property'. The decision of whether to use 'update property' was based on whether the property already exists in the subtree where the node is being spliced into. At the top level

[PATCH v7 04/17] powerpc/pseries: add of_node_put() in dlpar_detach_node()

2018-11-08 Thread frowand . list
From: Frank Rowand The previous commit, "of: overlay: add missing of_node_get() in __of_attach_node_sysfs" added a missing of_node_get() to __of_attach_node_sysfs(). This results in a refcount imbalance for nodes attached with dlpar_attach_node(). The calling sequence from dlpar_attach_node()

[PATCH v7 03/17] of: overlay: add missing of_node_get() in __of_attach_node_sysfs

2018-11-08 Thread frowand . list
From: Frank Rowand There is a matching of_node_put() in __of_detach_node_sysfs() Remove misleading comment from function header comment for of_detach_node(). This patch may result in memory leaks from code that directly calls the dynamic node add and delete functions directly instead of using

[PATCH v7 02/17] of: overlay: add missing of_node_put() after add new node to changeset

2018-11-08 Thread frowand . list
From: Frank Rowand The refcount of a newly added overlay node decrements to one (instead of zero) when the overlay changeset is destroyed. This change will cause the final decrement be to zero. After applying this patch, new validation warnings will be reported from the devicetree unittest

[PATCH v7 01/17] of: overlay: add tests to validate kfrees from overlay removal

2018-11-08 Thread frowand . list
From: Frank Rowand Add checks: - attempted kfree due to refcount reaching zero before overlay is removed - properties linked to an overlay node when the node is removed - node refcount > one during node removal in a changeset destroy, if the node was created by the changeset After

[PATCH v7 00/17] of: overlay: validation checks, subsequent fixes

2018-11-08 Thread frowand . list
From: Frank Rowand Add checks to (1) overlay apply process and (2) memory freeing triggered by overlay release. The checks are intended to detect possible memory leaks and invalid overlays. The checks revealed bugs in existing code. Fixed the bugs. While fixing bugs, noted other issues,

[PATCH v6 18/18] of: unittest: initialize args before calling of_*parse_*()

2018-11-05 Thread frowand . list
From: Frank Rowand Callers of of_irq_parse_one() blindly use the pointer args.np without checking whether of_irq_parse_one() had an error and thus did not set the value of args.np. Initialize args to zero so that using the format "%pOF" to show the value of args.np will show "(null)" when

[PATCH v6 17/18] of: unittest: find overlays[] entry by name instead of index

2018-11-05 Thread frowand . list
From: Frank Rowand One accessor of overlays[] was using a hard coded index value to find the correct array entry instead of searching for the entry containing the correct name. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 21 + 1 file

[PATCH v6 16/18] of: unittest: allow base devicetree to have symbol metadata

2018-11-05 Thread frowand . list
From: Frank Rowand The overlay metadata nodes in the FDT created from testcases.dts are not handled properly. The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be. Only the first property in the /__symbols__ node was added to the live devicetree if the

[PATCH v6 15/18] of: overlay: set node fields from properties when add new overlay node

2018-11-05 Thread frowand . list
From: Frank Rowand Overlay nodes added by add_changeset_node() do not have the node fields name, phandle, and type set. The node passed to __of_attach_node() when the add node changeset entry is processed does not contain any properties. The node's properties are located in add property

[PATCH v6 14/18] of: unittest: remove unused of_unittest_apply_overlay() argument

2018-11-05 Thread frowand . list
From: Frank Rowand Argument unittest_nr is not used in of_unittest_apply_overlay(), remove it. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c

[PATCH v6 13/18] of: overlay: check prevents multiple fragments touching same property

2018-11-05 Thread frowand . list
From: Frank Rowand Add test case of two fragments updating the same property. After adding the test case, the system hangs at end of boot, after after slub stack dumps from kfree() in crypto modprobe code. Multiple overlay fragments adding, modifying, or deleting the same property is not

[PATCH v6 12/18] of: overlay: check prevents multiple fragments add or delete same node

2018-11-05 Thread frowand . list
From: Frank Rowand Multiple overlay fragments adding or deleting the same node is not supported. Replace code comment of such, with check to detect the attempt and fail the overlay apply. Devicetree unittest where multiple fragments added the same node was added in the previous patch in the

[PATCH v6 11/18] of: overlay: test case of two fragments adding same node

2018-11-05 Thread frowand . list
From: Frank Rowand 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,

[PATCH v6 10/18] of: overlay: make all pr_debug() and pr_err() messages unique

2018-11-05 Thread frowand . list
From: Frank Rowand Make overlay.c debug and error messages unique so that they can be unambiguously found by grep. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/overlay.c

[PATCH v6 09/18] of: overlay: validate overlay properties #address-cells and #size-cells

2018-11-05 Thread frowand . list
From: Frank Rowand If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry

[PATCH v6 08/18] of: overlay: reorder fields in struct fragment

2018-11-05 Thread frowand . list
From: Frank Rowand Order the fields of struct fragment in the same order as struct of_overlay_notify_data. The order in struct fragment is not significant. If both structs are ordered the same then when examining the data in a debugger or dump the human involved does not have to remember which

[PATCH v6 07/18] of: dynamic: change type of of_{at, de}tach_node() to void

2018-11-05 Thread frowand . list
From: Frank Rowand of_attach_node() and of_detach_node() always return zero, so their return value is meaningless. Change their type to void and fix all callers to ignore return value. Tested-by: Alan Tull Signed-off-by: Frank Rowand --- arch/powerpc/platforms/pseries/dlpar.c| 13

[PATCH v6 06/18] of: overlay: do not duplicate properties from overlay for new nodes

2018-11-05 Thread frowand . list
From: Frank Rowand When allocating a new node, add_changeset_node() was duplicating the properties from the respective node in the overlay instead of allocating a node with no properties. When this patch is applied the errors reported by the devictree unittest from patch "of: overlay: add tests

[PATCH v6 05/18] of: overlay: use prop add changeset entry for property in new nodes

2018-11-05 Thread frowand . list
From: Frank Rowand The changeset entry 'update property' was used for new properties in an overlay instead of 'add property'. The decision of whether to use 'update property' was based on whether the property already exists in the subtree where the node is being spliced into. At the top level

[PATCH v6 04/18] powerpc/pseries: add of_node_put() in dlpar_detach_node()

2018-11-05 Thread frowand . list
From: Frank Rowand "of: overlay: add missing of_node_get() in __of_attach_node_sysfs" added a missing of_node_get() to __of_attach_node_sysfs(). This results in a refcount imbalance for nodes attached with dlpar_attach_node(). The calling sequence from dlpar_attach_node() to

[PATCH v6 03/18] of: overlay: add missing of_node_get() in __of_attach_node_sysfs

2018-11-05 Thread frowand . list
From: Frank Rowand There is a matching of_node_put() in __of_detach_node_sysfs() Remove misleading comment from function header comment for of_detach_node(). This patch may result in memory leaks from code that directly calls the dynamic node add and delete functions directly instead of using

[PATCH v6 02/18] of: overlay: add missing of_node_put() after add new node to changeset

2018-11-05 Thread frowand . list
From: Frank Rowand The refcount of a newly added overlay node decrements to one (instead of zero) when the overlay changeset is destroyed. This change will cause the final decrement be to zero. After applying this patch, new validation warnings will be reported from the devicetree unittest

[PATCH v6 01/18] of: overlay: add tests to validate kfrees from overlay removal

2018-11-05 Thread frowand . list
From: Frank Rowand Add checks: - attempted kfree due to refcount reaching zero before overlay is removed - properties linked to an overlay node when the node is removed - node refcount > one during node removal in a changeset destroy, if the node was created by the changeset After

[PATCH v6 00/18] of: overlay: validation checks, subsequent fixes

2018-11-05 Thread frowand . list
From: Frank Rowand Add checks to (1) overlay apply process and (2) memory freeing triggered by overlay release. The checks are intended to detect possible memory leaks and invalid overlays. The checks revealed bugs in existing code. Fixed the bugs. While fixing bugs, noted other issues,

[PATCH v5 18/18] of: unittest: initialize args before calling of_*parse_*()

2018-10-18 Thread frowand . list
From: Frank Rowand Callers of of_irq_parse_one() blindly use the pointer args.np without checking whether of_irq_parse_one() had an error and thus did not set the value of args.np. Initialize args to zero so that using the format "%pOF" to show the value of args.np will show "(null)" when

[PATCH v5 17/18] of: unittest: find overlays[] entry by name instead of index

2018-10-18 Thread frowand . list
From: Frank Rowand One accessor of overlays[] was using a hard coded index value to find the correct array entry instead of searching for the entry containing the correct name. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 21 + 1 file changed, 17 insertions(+),

[PATCH v5 16/18] of: unittest: allow base devicetree to have symbol metadata

2018-10-18 Thread frowand . list
From: Frank Rowand The overlay metadata nodes in the FDT created from testcases.dts are not handled properly. The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be. Only the first property in the /__symbols__ node was added to the live devicetree if the

[PATCH v5 15/18] of: overlay: set node fields from properties when add new overlay node

2018-10-18 Thread frowand . list
From: Frank Rowand Overlay nodes added by add_changeset_node() do not have the node fields name, phandle, and type set. The node passed to __of_attach_node() when the add node changeset entry is processed does not contain any properties. The node's properties are located in add property

[PATCH v5 14/18] of: unittest: remove unused of_unittest_apply_overlay() argument

2018-10-18 Thread frowand . list
From: Frank Rowand Argument unittest_nr is not used in of_unittest_apply_overlay(), remove it. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index

[PATCH v5 13/18] of: overlay: check prevents multiple fragments touching same property

2018-10-18 Thread frowand . list
From: Frank Rowand Add test case of two fragments updating the same property. After adding the test case, the system hangs at end of boot, after after slub stack dumps from kfree() in crypto modprobe code. Multiple overlay fragments adding, modifying, or deleting the same property is not

[PATCH v5 05/18] of: overlay: use prop add changeset entry for property in new nodes

2018-10-18 Thread frowand . list
From: Frank Rowand The changeset entry 'update property' was used for new properties in an overlay instead of 'add property'. The decision of whether to use 'update property' was based on whether the property already exists in the subtree where the node is being spliced into. At the top level

[PATCH v5 12/18] of: overlay: check prevents multiple fragments add or delete same node

2018-10-18 Thread frowand . list
From: Frank Rowand Multiple overlay fragments adding or deleting the same node is not supported. Replace code comment of such, with check to detect the attempt and fail the overlay apply. Devicetree unittest where multiple fragments added the same node was added in the previous patch in the

[PATCH v5 11/18] of: overlay: test case of two fragments adding same node

2018-10-18 Thread frowand . list
From: Frank Rowand 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,

[PATCH v5 10/18] of: overlay: make all pr_debug() and pr_err() messages unique

2018-10-18 Thread frowand . list
From: Frank Rowand Make overlay.c debug and error messages unique so that they can be unambiguously found by grep. Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c

[PATCH v5 09/18] of: overlay: validate overlay properties #address-cells and #size-cells

2018-10-18 Thread frowand . list
From: Frank Rowand If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry

[PATCH v5 08/18] of: overlay: reorder fields in struct fragment

2018-10-18 Thread frowand . list
From: Frank Rowand Order the fields of struct fragment in the same order as struct of_overlay_notify_data. The order in struct fragment is not significant. If both structs are ordered the same then when examining the data in a debugger or dump the human involved does not have to remember which

[PATCH v5 07/18] of: dynamic: change type of of_{at, de}tach_node() to void

2018-10-18 Thread frowand . list
From: Frank Rowand of_attach_node() and of_detach_node() always return zero, so their return value is meaningless. Change their type to void and fix all callers to ignore return value. Signed-off-by: Frank Rowand --- arch/powerpc/platforms/pseries/dlpar.c| 13 ++---

[PATCH v5 06/18] of: overlay: do not duplicate properties from overlay for new nodes

2018-10-18 Thread frowand . list
From: Frank Rowand When allocating a new node, add_changeset_node() was duplicating the properties from the respective node in the overlay instead of allocating a node with no properties. When this patch is applied the errors reported by the devictree unittest from patch "of: overlay: add tests

[PATCH v5 04/18] powerpc/pseries: add of_node_put() in dlpar_detach_node()

2018-10-18 Thread frowand . list
From: Frank Rowand "of: overlay: add missing of_node_get() in __of_attach_node_sysfs" added a missing of_node_get() to __of_attach_node_sysfs(). This results in a refcount imbalance for nodes attached with dlpar_attach_node(). The calling sequence from dlpar_attach_node() to

[PATCH v5 03/18] of: overlay: add missing of_node_get() in __of_attach_node_sysfs

2018-10-18 Thread frowand . list
From: Frank Rowand There is a matching of_node_put() in __of_detach_node_sysfs() Remove misleading comment from function header comment for of_detach_node(). This patch may result in memory leaks from code that directly calls the dynamic node add and delete functions directly instead of using

[PATCH v5 02/18] of: overlay: add missing of_node_put() after add new node to changeset

2018-10-18 Thread frowand . list
From: Frank Rowand The refcount of a newly added overlay node decrements to one (instead of zero) when the overlay changeset is destroyed. This change will cause the final decrement be to zero. After applying this patch, new validation warnings will be reported from the devicetree unittest

[PATCH v5 00/18] of: overlay: validation checks, subsequent fixes

2018-10-18 Thread frowand . list
From: Frank Rowand Add checks to (1) overlay apply process and (2) memory freeing triggered by overlay release. The checks are intended to detect possible memory leaks and invalid overlays. The checks revealed bugs in existing code. Fixed the bugs. While fixing bugs, noted other issues,

[PATCH v5 01/18] of: overlay: add tests to validate kfrees from overlay removal

2018-10-18 Thread frowand . list
From: Frank Rowand Add checks: - attempted kfree due to refcount reaching zero before overlay is removed - properties linked to an overlay node when the node is removed - node refcount > one during node removal in a changeset destroy, if the node was created by the changeset After

[PATCH v4 18/18] of: unittest: initialize args before calling of_*parse_*()

2018-10-15 Thread frowand . list
From: Frank Rowand Callers of of_irq_parse_one() blindly use the pointer args.np without checking whether of_irq_parse_one() had an error and thus did not set the value of args.np. Initialize args to zero so that using the format "%pOF" to show the value of args.np will show "(null)" when

[PATCH v4 17/18] of: unittest: find overlays[] entry by name instead of index

2018-10-15 Thread frowand . list
From: Frank Rowand One accessor of overlays[] was using a hard coded index value to find the correct array entry instead of searching for the entry containing the correct name. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 21 + 1 file changed, 17 insertions(+),

[PATCH v4 16/18] of: unittest: allow base devicetree to have symbol metadata

2018-10-15 Thread frowand . list
From: Frank Rowand The overlay metadata nodes in the FDT created from testcases.dts are not handled properly. The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be. Only the first property in the /__symbols__ node was added to the live devicetree if the

[PATCH v4 15/18] of: overlay: set node fields from properties when add new overlay node

2018-10-15 Thread frowand . list
From: Frank Rowand Overlay nodes added by add_changeset_node() do not have the node fields name, phandle, and type set. The node passed to __of_attach_node() when the add node changeset entry is processed does not contain any properties. The node's properties are located in add property

[PATCH v4 14/18] of: unittest: remove unused of_unittest_apply_overlay() argument

2018-10-15 Thread frowand . list
From: Frank Rowand Argument unittest_nr is not used in of_unittest_apply_overlay(), remove it. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index

[PATCH v4 13/18] of: overlay: check prevents multiple fragments touching same property

2018-10-15 Thread frowand . list
From: Frank Rowand Add test case of two fragments updating the same property. After adding the test case, the system hangs at end of boot, after after slub stack dumps from kfree() in crypto modprobe code. Multiple overlay fragments adding, modifying, or deleting the same property is not

[PATCH v4 12/18] of: overlay: check prevents multiple fragments add or delete same node

2018-10-15 Thread frowand . list
From: Frank Rowand Multiple overlay fragments adding or deleting the same node is not supported. Replace code comment of such, with check to detect the attempt and fail the overlay apply. Devicetree unittest where multiple fragments added the same node was added in the previous patch in the

[PATCH v4 11/18] of: overlay: test case of two fragments adding same node

2018-10-15 Thread frowand . list
From: Frank Rowand 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,

[PATCH v4 10/18] of: overlay: make all pr_debug() and pr_err() messages unique

2018-10-15 Thread frowand . list
From: Frank Rowand Make overlay.c debug and error messages unique so that they can be unambiguously found by grep. Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c

[PATCH v4 09/18] of: overlay: validate overlay properties #address-cells and #size-cells

2018-10-15 Thread frowand . list
From: Frank Rowand If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry

[PATCH v4 08/18] of: overlay: reorder fields in struct fragment

2018-10-15 Thread frowand . list
From: Frank Rowand Order the fields of struct fragment in the same order as struct of_overlay_notify_data. The order in struct fragment is not significant. If both structs are ordered the same then when examining the data in a debugger or dump the human involved does not have to remember which

[PATCH v4 07/18] of: dynamic: change type of of_{at, de}tach_node() to void

2018-10-15 Thread frowand . list
From: Frank Rowand of_attach_node() and of_detach_node() always return zero, so their return value is meaningless. Change their type to void and fix all callers to ignore return value. Signed-off-by: Frank Rowand --- arch/powerpc/platforms/pseries/dlpar.c| 13 ++---

[PATCH v4 06/18] of: overlay: do not duplicate properties from overlay for new nodes

2018-10-15 Thread frowand . list
From: Frank Rowand When allocating a new node, add_changeset_node() was duplicating the properties from the respective node in the overlay instead of allocating a node with no properties. When this patch is applied the errors reported by the devictree unittest from patch "of: overlay: add tests

[PATCH v4 05/18] of: overlay: use prop add changeset entry for property in new nodes

2018-10-15 Thread frowand . list
From: Frank Rowand The changeset entry 'update property' was used for new properties in an overlay instead of 'add property'. The decision of whether to use 'update property' was based on whether the property already exists in the subtree where the node is being spliced into. At the top level

[PATCH v4 04/18] powerpc/pseries: add of_node_put() in dlpar_detach_node()

2018-10-15 Thread frowand . list
From: Frank Rowand "of: overlay: add missing of_node_get() in __of_attach_node_sysfs" added a missing of_node_get() to __of_attach_node_sysfs(). This results in a refcount imbalance for nodes attached with dlpar_attach_node(). The calling sequence from dlpar_attach_node() to

[PATCH v4 03/18] of: overlay: add missing of_node_get() in __of_attach_node_sysfs

2018-10-15 Thread frowand . list
From: Frank Rowand There is a matching of_node_put() in __of_detach_node_sysfs() Remove misleading comment from function header comment for of_detach_node(). This patch may result in memory leaks from code that directly calls the dynamic node add and delete functions directly instead of using

[PATCH v4 02/18] of: overlay: add missing of_node_put() after add new node to changeset

2018-10-15 Thread frowand . list
From: Frank Rowand The refcount of a newly added overlay node decrements to one (instead of zero) when the overlay changeset is destroyed. This change will cause the final decrement be to zero. After applying this patch, new validation warnings will be reported from the devicetree unittest

[PATCH v4 01/18] of: overlay: add tests to validate kfrees from overlay removal

2018-10-15 Thread frowand . list
From: Frank Rowand Add checks: - attempted kfree due to refcount reaching zero before overlay is removed - properties linked to an overlay node when the node is removed - node refcount > one during node removal in a changeset destroy, if the node was created by the changeset After

[PATCH v4 00/18] of: overlay: validation checks, subsequent fixes

2018-10-15 Thread frowand . list
From: Frank Rowand Add checks to (1) overlay apply process and (2) memory freeing triggered by overlay release. The checks are intended to detect possible memory leaks and invalid overlays. The checks revealed bugs in existing code. Fixed the bugs. While fixing bugs, noted other issues,

[PATCH v3 18/18] of: unittest: initialize args before calling of_*parse_*()

2018-10-14 Thread frowand . list
From: Frank Rowand Callers of of_irq_parse_one() blindly use the pointer args.np without checking whether of_irq_parse_one() had an error and thus did not set the value of args.np. Initialize args to zero so that using the format "%pOF" to show the value of args.np will show "(null)" when

[PATCH v3 17/18] of: unittest: find overlays[] entry by name instead of index

2018-10-14 Thread frowand . list
From: Frank Rowand One accessor of overlays[] was using a hard coded index value to find the correct array entry instead of searching for the entry containing the correct name. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 21 + 1 file changed, 17 insertions(+),

[PATCH v3 16/18] of: unittest: allow base devicetree to have symbol metadata

2018-10-14 Thread frowand . list
From: Frank Rowand The overlay metadata nodes in the FDT created from testcases.dts are not handled properly. The __fixups__ and __local_fixups__ node were added to the live devicetree, but should not be. Only the first property in the /__symbols__ node was added to the live devicetree if the

[PATCH v3 15/18] of: overlay: set node fields from properties when add new overlay node

2018-10-14 Thread frowand . list
From: Frank Rowand Overlay nodes added by add_changeset_node() do not have the node fields name, phandle, and type set. The node passed to __of_attach_node() when the add node changeset entry is processed does not contain any properties. The node's properties are located in add property

[PATCH v3 14/18] of: unittest: remove unused of_unittest_apply_overlay() argument

2018-10-14 Thread frowand . list
From: Frank Rowand Argument unittest_nr is not used in of_unittest_apply_overlay(), remove it. Signed-off-by: Frank Rowand --- drivers/of/unittest.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index

[PATCH v3 13/18] of: overlay: check prevents multiple fragments touching same property

2018-10-14 Thread frowand . list
From: Frank Rowand Add test case of two fragments updating the same property. After adding the test case, the system hangs at end of boot, after after slub stack dumps from kfree() in crypto modprobe code. Multiple overlay fragments adding, modifying, or deleting the same property is not

[PATCH v3 12/18] of: overlay: check prevents multiple fragments add or delete same node

2018-10-14 Thread frowand . list
From: Frank Rowand Multiple overlay fragments adding or deleting the same node is not supported. Replace code comment of such, with check to detect the attempt and fail the overlay apply. Devicetree unittest where multiple fragments added the same node was added in the previous patch in the

[PATCH v3 11/18] of: overlay: test case of two fragments adding same node

2018-10-14 Thread frowand . list
From: Frank Rowand 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,

[PATCH v3 10/18] of: overlay: make all pr_debug() and pr_err() messages unique

2018-10-14 Thread frowand . list
From: Frank Rowand Make overlay.c debug and error messages unique so that they can be unambiguously found by grep. Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c

[PATCH v3 09/18] of: overlay: validate overlay properties #address-cells and #size-cells

2018-10-14 Thread frowand . list
From: Frank Rowand If overlay properties #address-cells or #size-cells are already in the live devicetree for any given node, then the values in the overlay must match the values in the live tree. If the properties are already in the live tree then there is no need to create a changeset entry

[PATCH v3 08/18] of: overlay: reorder fields in struct fragment

2018-10-14 Thread frowand . list
From: Frank Rowand Order the fields of struct fragment in the same order as struct of_overlay_notify_data. The order in struct fragment is not significant. If both structs are ordered the same then when examining the data in a debugger or dump the human involved does not have to remember which

[PATCH v3 07/18] of: dynamic: change type of of_{at, de}tach_node() to void

2018-10-14 Thread frowand . list
From: Frank Rowand of_attach_node() and of_detach_node() always return zero, so their return value is meaningless. Change their type to void and fix all callers to ignore return value. Signed-off-by: Frank Rowand --- arch/powerpc/platforms/pseries/dlpar.c| 13 ++---

[PATCH v3 06/18] of: overlay: do not duplicate properties from overlay for new nodes

2018-10-14 Thread frowand . list
From: Frank Rowand When allocating a new node, add_changeset_node() was duplicating the properties from the respective node in the overlay instead of allocating a node with no properties. When this patch is applied the errors reported by the devictree unittest from patch "of: overlay: add tests

[PATCH v3 05/18] of: overlay: use prop add changeset entry for property in new nodes

2018-10-14 Thread frowand . list
From: Frank Rowand The changeset entry 'update property' was used for new properties in an overlay instead of 'add property'. The decision of whether to use 'update property' was based on whether the property already exists in the subtree where the node is being spliced into. At the top level

  1   2   >