of: overlay: remove unused of_overlay_remove_all()

of_overlay_remove_all() has no in-tree callers.

It is also subtly broken. It passes &ovcs->id to of_overlay_remove(),
which zeroes *ovcs_id once the changeset is reverted, before calling
free_overlay_changeset(). Through the aliased pointer that zeroes
ovcs->id itself, so free_overlay_changeset()'s "ovcs->id > 0" guard is
false and both idr_remove() and list_del() are skipped: the
overlay_changeset is kfree()d while still linked in ovcs_list and
registered in ovcs_idr.

Rather than fix a helper nobody calls, remove it, along with its
!CONFIG_OF_OVERLAY stub and the paragraph documenting it in
overlay-notes.rst and in the zh_CN translation.

ovcs_list itself stays: overlay_removal_is_ok() still walks it to check
that a changeset is topmost.

Reported-by: Sashiko AI <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/20260901014554.83A8D1F000E9@smtp.kernel.org
Suggested-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/all/20260928182658.GA185307-robh@kernel.org/
Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Link: https://patch.msgid.link/20261014-b4-of-overlay-remove-all-fix-v2-1-cf5ea2cc9dc3@nexthop.ai
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
This commit is contained in:
Abdurrahman Hussain 2026-10-14 15:59:36 -07:00 committed by Rob Herring (Arm)
parent 22a77ae9ba
commit 24873b2778
4 changed files with 0 additions and 36 deletions

View File

@ -115,10 +115,6 @@ The API is quite easy to use.
previously created via the call to of_overlay_fdt_apply(). Removal of an
overlay changeset that is stacked by another will not be permitted.
Finally, if you need to remove all overlays in one-go, just call
of_overlay_remove_all() which will remove every single one in the correct
order.
There is the option to register notifiers that get called on
overlay operations. See of_overlay_notifier_register/unregister and
enum of_overlay_notify_action for details.

View File

@ -116,9 +116,6 @@ DT中的适当位置。在这种情况下,可以提供目标路径。通过标
2) 调用of_overlay_remove()来删除和清理先前通过调用of_overlay_fdt_apply()
而创建的覆盖变更集。不允许删除一个被另一个覆盖的覆盖变化集。
最后,如果你需要一次性删除所有的覆盖,只需调用of_overlay_remove_all(),
它将以正确的顺序删除每一个覆盖。
你可以选择注册在覆盖操作中被调用的通知器。详见
of_overlay_notifier_register/unregister和enum of_overlay_notify_action。

View File

@ -1273,26 +1273,3 @@ int of_overlay_remove(int *ovcs_id)
return ret;
}
EXPORT_SYMBOL_GPL(of_overlay_remove);
/**
* of_overlay_remove_all() - Reverts and frees all overlay changesets
*
* Removes all overlays from the system in the correct order.
*
* Return: 0 on success, or a negative error number
*/
int of_overlay_remove_all(void)
{
struct overlay_changeset *ovcs, *ovcs_n;
int ret;
/* the tail of list is guaranteed to be safe to remove */
list_for_each_entry_safe_reverse(ovcs, ovcs_n, &ovcs_list, ovcs_list) {
ret = of_overlay_remove(&ovcs->id);
if (ret)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(of_overlay_remove_all);

View File

@ -1837,7 +1837,6 @@ struct of_overlay_notify_data {
int of_overlay_fdt_apply(const void *overlay_fdt, u32 overlay_fdt_size,
int *ovcs_id, const struct device_node *target_base);
int of_overlay_remove(int *ovcs_id);
int of_overlay_remove_all(void);
int of_overlay_notifier_register(struct notifier_block *nb);
int of_overlay_notifier_unregister(struct notifier_block *nb);
@ -1855,11 +1854,6 @@ static inline int of_overlay_remove(int *ovcs_id)
return -ENOTSUPP;
}
static inline int of_overlay_remove_all(void)
{
return -ENOTSUPP;
}
static inline int of_overlay_notifier_register(struct notifier_block *nb)
{
return 0;