summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2018-05-14 19:40:20 -0500
committerRob Herring <robh@kernel.org>2018-05-14 19:44:23 -0500
commit9601000cd57e395b56642596903f59d61d91e176 (patch)
tree7814fb1ce622f586dfc77641b04a1824866a90fd /drivers
parent2ff0e41ac5a7b5c3f1ac1a82f4bbf6083ae09d8d (diff)
parentf130307054a59ca21d2396f386be77ebd2e8ca96 (diff)
downloadlinux-0-day-9601000cd57e395b56642596903f59d61d91e176.tar.gz
linux-0-day-9601000cd57e395b56642596903f59d61d91e176.tar.xz
Merge tag 'devicetree-fixes-for-4.17' into dt/next to pick-up fixes
Diffstat (limited to 'drivers')
-rw-r--r--drivers/of/overlay.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index b35fe88f18514..7baa53e5b1d74 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -102,12 +102,28 @@ static DEFINE_IDR(ovcs_idr);
static BLOCKING_NOTIFIER_HEAD(overlay_notify_chain);
+/**
+ * of_overlay_notifier_register() - Register notifier for overlay operations
+ * @nb: Notifier block to register
+ *
+ * Register for notification on overlay operations on device tree nodes. The
+ * reported actions definied by @of_reconfig_change. The notifier callback
+ * furthermore receives a pointer to the affected device tree node.
+ *
+ * Note that a notifier callback is not supposed to store pointers to a device
+ * tree node or its content beyond @OF_OVERLAY_POST_REMOVE corresponding to the
+ * respective node it received.
+ */
int of_overlay_notifier_register(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&overlay_notify_chain, nb);
}
EXPORT_SYMBOL_GPL(of_overlay_notifier_register);
+/**
+ * of_overlay_notifier_register() - Unregister notifier for overlay operations
+ * @nb: Notifier block to unregister
+ */
int of_overlay_notifier_unregister(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&overlay_notify_chain, nb);
@@ -671,17 +687,13 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs)
of_node_put(ovcs->fragments[i].overlay);
}
kfree(ovcs->fragments);
-
/*
- * TODO
- *
- * would like to: kfree(ovcs->overlay_tree);
- * but can not since drivers may have pointers into this data
- *
- * would like to: kfree(ovcs->fdt);
- * but can not since drivers may have pointers into this data
+ * There should be no live pointers into ovcs->overlay_tree and
+ * ovcs->fdt due to the policy that overlay notifiers are not allowed
+ * to retain pointers into the overlay devicetree.
*/
-
+ kfree(ovcs->overlay_tree);
+ kfree(ovcs->fdt);
kfree(ovcs);
}